import re
line = 'hello 世界'
txts = list(line)
for ch in txts:
if u'\u9fff' >= ch >= u'\u4e00':
print("ch is chinese.")
elif re.search('[A-Z▁]', ch):
print("ch is english.")
Python笔记--中英文字符判断
最新推荐文章于 2023-04-01 22:28:33 发布