我有一个英语语言的工作模式,但由于我的母语不起作用,这让我很头疼.首先,我打开了许多关于编码的问题,我知道我低估了它,这是一个大问题.我花了一些时间阅读它,问题仍然存在.所以现在我正面临一个正则表达问题.所以模式是:
exactMatch = re.compile(r"([^\.]*\b???????\b[^\.]*)\.", re.UNICODE)
print exactMatch.pattern
result= exactMatch.findall("??????? ? ?? ????? ?? ????????????. ??????? ? ?? ????? ?? ????????????.")
Run Code Online (Sandbox Code Playgroud)
它适用于英语.它的功能是给我一个段落中的所有句子.那有什么建议吗?
我也试过编码和解码,但注意到编码错误除外.
这将工作:
exactMatch = re.compile(ur"([^\.]*\b???????\b[^\.]*)\.", re.UNICODE)
print exactMatch.pattern
result= exactMatch.findall(u"??????? ? ?? ????? ?? ????????????. ??????? ? ?? ????? ?? ????????????.")
Run Code Online (Sandbox Code Playgroud)
如果你使用unicode,那么使用 unicode.
| 归档时间: |
|
| 查看次数: |
3299 次 |
| 最近记录: |