Shu*_*ong 5 unicode python-3.x python-3.4
我想知道有什么方法可以在 Python 3 中检查汉字是简体中文还是繁体中文?
小智 5
cjklib不支持 Python 3。在 Python 3 中,您可以使用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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1752 次 |
| 最近记录: |