我想知道Python 3中有没有什么方法可以检查一个汉字是简体中文还是繁体中文?
cjklib
不支持Python 3。在Python 3中,您可以使用hanzidentifier https://pypi.org/project/hanzidentifier/.
import hanzidentifier
print(hanzidentifier.has_chinese('Hello my name is John.'))
》 False
print(hanzidentifier.has_chinese('Country in Simplified: 国家. Country in Traditional: 國家.'))
》 True
print(hanzidentifier.is_simplified('John说:你好!'))
》 True
print(hanzidentifier.is_traditional('John說:你好!'))
》 True
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)