Created
February 15, 2017 17:24
-
-
Save silverskyvicto/73bc1fb870e0c36b4ab6e1fca7cccd24 to your computer and use it in GitHub Desktop.
EmojiRemove.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #!/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