字符处理

1、判断是否为汉字:

char = '我'
print((char >= u'\u4e00') and (char <= u'\u9fa5'))

输出:

True

 

你可能感兴趣的:(python,NLP)