zoukankan      html  css  js  c++  java
  • opencc模块用langconv替换

    将一下两个py下载并放入代码目录:
    https://raw.githubusercontent.com/skydark/nstools/master/zhtools/langconv.py
    https://raw.githubusercontent.com/skydark/nstools/master/zhtools/zh_wiki.py

    from langconv import *
    import sys
    
    print(sys.version)
    print(sys.version_info)
    
    # 转换繁体到简体
    def cht_to_chs(line):
    line = Converter('zh-hans').convert(line)
    line.encode('utf-8')
    return line
    
    # 转换简体到繁体
    def chs_to_cht(line):
    line = Converter('zh-hant').convert(line)
    line.encode('utf-8')
    return line
    
    line_chs='<>123asdasd把中文字符串进行繁体和简体中文的转换'
    line_cht='<>123asdasd把中文字符串進行繁體和簡體中文的轉換'
    
    ret_chs = "%s
    "%cht_to_chs(line_cht)
    ret_cht = "%s
    "%chs_to_cht(line_chs)
    
    print("chs='%s'",ret_cht)
    print("cht='%s'",ret_cht)
    
    file = open('ret.txt','w',encoding='utf-8')
    file.write(ret_chs)
    file.write(ret_cht)
    file.close()
  • 相关阅读:
    STL set
    STL pair
    STL简介
    最长公共子序列lcs
    MySQL常用内置函数整理
    MySQL注入点写webshell的五种方式
    phpAdmin写webshell的方法
    mysql之突破secure_file_priv写webshell
    MySQL提权之启动项提权
    MySQL提权之mof提权
  • 原文地址:https://www.cnblogs.com/blogpro/p/11340529.html
Copyright © 2011-2022 走看看