【发布时间】:2016-04-22 08:52:46
【问题描述】:
我的 Python RegEx 处理块在处理重音表达式时遇到问题。 当我运行我的代码时:
import re
title = ur"Titre : c'est pas gréable à Infos:"
print title
m = re.findall(":(.+?) Infos",title , re.UNICODE)
print unicode((m))
我有这个结果:
Titre : c'est pas gréable à Infos:
[u" c'est pas gr\xe9able \xe0"]
我需要能够在结果输出中保留重音表达。 感谢您的帮助
【问题讨论】:
-
您只是看到同一个 unicode 字符串的两种不同表示形式,一种使用 unicode 字符,另一种使用 utf-8 编码。
标签: python regex python-2.7 unicode non-ascii-characters