参考链接:
- https://stackoverflow.com/questions/2718196/find-all-chinese-text-in-a-string-using-python-and-regex
- https://www.runoob.com/python/python-reg-expressions.html
直接上代码记录一下。
import re
s = 'hello world! 中文'
pattern = re.compile('[\u4e00-\u9fff]+')
result = pattern.search(s)
if result:
index = result.span(0)[0]
print(s[index: len(s)])
1299

被折叠的 条评论
为什么被折叠?



