Unicode 转 汉字

目标 URL:http://tool.chinaz.com/tools/unicode.aspx

from bs4 import BeautifulSoup as bs


def find_data(res):
    soup = bs(res.text, "html.parser")

    target = soup.find("textarea", id="result")

    return target.text
    

def convert(content):
    data = {}
    data["content"] = content
    data["untoch"] = "Unicode 转 中文"
    
    res = post("http://tool.chinaz.com/tools/unicode.aspx", data=data)
    target = find_data(res)

    return target

if __name__ == "__main__":
    while True:
        content = input("请输入 Unicode 代码:")
        
        target = convert(content)
        
        print(f"\n{target}\n")```

猜你喜欢

转载自www.cnblogs.com/whx2008/p/12628493.html