安装
正常安装出错,然后参考这里:https://www.jianshu.com/p/a2a81c201a3f
pip install opencc-python-reimplemented
亲测有效。
用法
from opencc import OpenCC
# 繁体转简体
cc = OpenCC('t2s')
print(cc.convert('測試一下'))
#简体转繁体
cc = OpenCC('s2t')
print(cc.convert('测试一下'))
正常安装出错,然后参考这里:https://www.jianshu.com/p/a2a81c201a3f
pip install opencc-python-reimplemented
亲测有效。
from opencc import OpenCC
# 繁体转简体
cc = OpenCC('t2s')
print(cc.convert('測試一下'))
#简体转繁体
cc = OpenCC('s2t')
print(cc.convert('测试一下'))