一个字符串可能是这个
ipath= "./data/NCDC/上海/虹桥/9705626661750dat.txt"
或这个
ipath = './data/NCDC/ciampino/6240476818161dat.txt'
我怎么知道第一个字符串包含 chinese ?
我发现这个答案可能有帮助: Find all Chinese text in a string using Python and Regex
但没有成功:
import re
ipath= "./data/NCDC/上海/虹桥/9705626661750dat.txt"
re.findall(ur'[\u4e00-\u9fff]+', ipath) # => []
原文由 cqcn1991 发布,翻译遵循 CC BY-SA 4.0 许可协议
匹配的字符串也应该是 unicode