Skip to content

Instantly share code, notes, and snippets.

@n1n9-jp
Created November 7, 2019 07:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n1n9-jp/5857d7725f3b14cbc8ec3e878e4307ce to your computer and use it in GitHub Desktop.
Save n1n9-jp/5857d7725f3b14cbc8ec3e878e4307ce to your computer and use it in GitHub Desktop.
Python code to remove emoji
# Python code to remove emoji
# source: http://www.unicode.org/charts/
import re
def remove_emojis(data):
emoj = re.compile("["
u"\U00002700-\U000027BF" # Dingbats
u"\U0001F600-\U0001F64F" # Emoticons
u"\U00002600-\U000026FF" # Miscellaneous Symbols
u"\U0001F300-\U0001F5FF" # Miscellaneous Symbols And Pictographs
u"\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
u"\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
u"\U0001F680-\U0001F6FF" # Transport and Map Symbols
"]+", re.UNICODE)
return re.sub(emoj, '', data)
return remove_emojis(value)
@stm544880
Copy link

that's what I need. Thanks

@zhugw
Copy link

zhugw commented Nov 29, 2022

supplement
"𝟭▪️ 𝗢.𝗣.𝗦" ==> ▪️ ..

should add

u'[\U00010000-\U0010ffff]'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment