推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wdg8106
V2EX  ›  Python

python 怎么过滤 emoji 表情符号呢

  •  
  •   wdg8106 · Apr 27, 2016 · 11836 views
    This topic created in 3693 days ago, the information mentioned may be changed or developed.
    看一篇文章写的, emoji 的 区间为 \u1F601-\u1F64F ,
    然后我用正则表达式
    re.compile(u'[\uF601-\u1F64F]').sub(u'',name)
    进行过滤,并没有起到效果呢,请问大家遇到表情符号是怎么解决的呢
    2 replies    2016-04-27 21:17:20 +08:00
    GPU
        1
    GPU  
       Apr 27, 2016   ❤️ 1
    try:
    # UCS-4
    Emoji = re.compile(u'[\U00010000-\U0010ffff]')
    except re.error:
    # UCS-2
    Emoji = re.compile(u'[\uD800-\uDBFF][\uDC00-\uDFFF]')
    name = Emoji.sub(u'\u25FD', name)

    By @sciooga
    Khlieb
        2
    Khlieb  
       Apr 27, 2016 via Android   ❤️ 1
    Emoji 其实不止一个区间
    https://en.wikipedia.org/wiki/Emoji
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3028 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:28 · PVG 21:28 · LAX 06:28 · JFK 09:28
    ♥ Do have faith in what you're doing.