发布时间:2019-08-11 11:27:12编辑:auto阅读(1922)
Python 3.6
代码:
# -*- coding: utf-8 -*
def to_unicode(string):
ret = ''
for v in string:
ret = ret + hex(ord(v)).upper().replace('0X', '\\u')
return ret
print(to_unicode("中国"))
输出:
"D:\Program Files (x86)\Python36-32\python.exe" E:/PycharmProjects/Test/test.py
\u4E2D\u56FD
Process finished with exit code 0
上一篇: python3 闭包
下一篇: 用Python编写WEB服务器压力测试工
46587
44489
35920
33485
28171
24741
23661
18867
18161
16846
4656°
5215°
4745°
4878°
5543°
4507°
4559°
5099°
5003°
6252°