|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 一个账号 于 2020-4-10 22:11 编辑
- def convert(content):
- return content.encode("UTF-8").decode("Unicode_Escape")
- if __name__ == "__main__":
- while True:
- content = input("请输入 Unicode 代码:")
-
- target = convert(content)
-
- print(f"\n{target}\n")
复制代码
- from requests import post
- from bs4 import BeautifulSoup as bs
- def convert(content):
- def find_data(res):
- soup = bs(res.text, "html.parser")
- target = soup.find("textarea", id="result")
- return target.text
- 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")
复制代码
- 请输入 Unicode 代码:\u5317\u4eac\u5e02
- 北京市
复制代码 |
|