好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

python实现中文字符繁体和简体中文转换

需求:把中文字符串进行繁体和简体中文的转换;

2、代码实例

# -*- coding:utf-8 -*-
  
    from langconv import *
  
# 转换繁体到简体
line = Converter('zh-hans').convert(line.decode('utf-8'))
line = line.encode('utf-8')
  
# 转换简体到繁体
line = Converter('zh-hant').convert(line.decode('utf-8'))
line = line.encode('utf-8') 

查看更多关于python实现中文字符繁体和简体中文转换的详细内容...

  阅读:50次