Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@silverskyvicto
Created February 15, 2017 17:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silverskyvicto/73bc1fb870e0c36b4ab6e1fca7cccd24 to your computer and use it in GitHub Desktop.
Save silverskyvicto/73bc1fb870e0c36b4ab6e1fca7cccd24 to your computer and use it in GitHub Desktop.
EmojiRemove.py
# #!/usr/bin/env python
# xmlファイル内の絵文字除去用スクリプト
import sys
import re
# チェック元ファイル
f = open(sys.argv[1])
# 絵文字除去後のファイル
new_file = open('EmojiRemovedFile.xml', 'a')
# 正規表現パターンを構築
emoji_pattern = re.compile("["
u"\U0001F600-\U0001F64F"
u"\U0001F300-\U0001F5FF"
u"\U0001F680-\U0001F6FF"
u"\U0001F1E0-\U0001F1FF"
"]+", flags=re.UNICODE)
# 1行ずつ処理
for line in f:
f.write(emoji_pattern.sub(r'@emoji', line))
f.close();
new_file.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment