推荐学习书目
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
wwg1994
V2EX  ›  Python

Python 原生字符串的问题,来个大佬救救我

  •  
  •   wwg1994 · Dec 21, 2018 · 677 views
    This topic created in 2730 days ago, the information mentioned may be changed or developed.

    想对 unicode 编码做字符串的操作,要把 a 转成原生字符串 b,百度不到呀,又不会科学上网,大佬们帮帮我

    a = '\uf85c\ue24c.\uf8e9'

    b = func(a) 我就想找到这样一个方法把 a 转成 b,C 是目标结果

    b = r'\uf85c\ue24c.\uf8e9'

    c = re.sub(r'\..', '', b)

    wwg1994
        1
    wwg1994  
    OP
       Dec 21, 2018
    a 是爬虫爬下的一串字符
    chenstack
        2
    chenstack  
       Dec 21, 2018   ❤️ 2
    b = a.encode('unicode_escape').decode()
    wwg1994
        3
    wwg1994  
    OP
       Dec 21, 2018
    @chenstack 感谢大佬(づ ̄ 3  ̄)づ
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1139 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:04 · PVG 02:04 · LAX 11:04 · JFK 14:04
    ♥ Do have faith in what you're doing.