Requirements: The Chinese character strings for traditional and simplified Chinese conversion;
Idea: Introduction of simple traditional processing library, interested students can study the internal implementation, are written by Python
1. Download zh_wiki.py and Langconv
zh_wiki.py:https://github.com/skydark/nstools/blob/master/zhtools/zh_wiki.py
langconv.py:https://github.com/skydark/nstools/blob/master/zhtools/langconv.py
Download langconv.py and zh_wiki.py, and put it in the directory where Python code is located
2. code example
#-*-Coding:utf-8-*- from langconv import * # Convert traditional to Simplified line = Converter (' Zh-hans '). Convert (Line.decode (' Utf-8 ') line = Line.encode (' utf-8 ') # Convert simplified to Traditional line = Converter (' zh-hant '). Convert (Line.decode (' utf-8 ')) line = Line.encode (' Utf-8 ')