解决:Python如何判断字符串中是否有中文
- 1 In [240]: s
- 2 Out[240]: '你好aa'
- 3
- 4 In [241]: for i in s:
- 5 ...: if u'\u4e00' <= i <= u'\u9fff':
- 6 ...: print("yes")
- 7 ...: else:
- 8 ...: print("no")
- 1 yes
- 2 yes
- 3 no
- 4 no