V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
figol
V2EX  ›  Python

想用 python 去除 xml 文件中的法语字母 à â ä è é î ô等;大牛们,有没有好方法推荐?

  •  
  •   figol ·
    figol · 2014-10-22 18:03:43 +08:00 · 4795 次点击
    这是一个创建于 3464 天前的主题,其中的信息可能已经有所发展或是发生改变。
    7 条回复    2014-10-22 20:37:26 +08:00
    icedx
        1
    icedx  
       2014-10-22 18:08:19 +08:00 via Android
    你搜下 这个问题很有名…
    具体链接忘记了...
    plprapper
        2
    plprapper  
       2014-10-22 18:14:23 +08:00
    asc 有范围吗
    poke707
        3
    poke707  
       2014-10-22 18:40:08 +08:00 via Android
    这些字符估计其unicode是连着的,简单的正则即可替换掉
    Actrace
        4
    Actrace  
       2014-10-22 18:53:17 +08:00
    法语字母不多吧 ..?
    匹配替换.
    wangfengmadking
        5
    wangfengmadking  
       2014-10-22 19:30:13 +08:00
    我一般就用.encode('ascii', "ignore")来忽略了
    GeekGao
        6
    GeekGao  
       2014-10-22 19:35:27 +08:00
    查下unicode字符集表 http://www.tamasoft.co.jp/en/general-info/unicode.html
    找到区间:00C0~0100 (我不懂法语,看着像而已)
    写正则匹配^[\u00C0-\u0100]+$

    思路基本这样子。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3290 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:16 · PVG 21:16 · LAX 06:16 · JFK 09:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.