06_python

2020-08-13  本文已影响0人  伶俐ll

利用python打印字符

zhanglingli@bogon ~ % python

WARNING: Python 2.7 is not recommended. 
This version is included in macOS for compatibility with legacy software. 
Future versions of macOS will not include Python 2.7. 
Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Apr 17 2020, 18:29:03) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'\u767b\u5f55'
登录
>>> unicode('登录','UTF-8')
u'\u767b\u5f55'
>>> exit()
>>> print '\xe7\x99\xbb\xe5\xbd\x95'
登录
>>> unicode('登录','UTF-8').encode('UTF-8')
'\xe7\x99\xbb\xe5\xbd\x95'
>>> unicode('登录','UTF-8')
u'\u767b\u5f55'
>>> 

上一篇 下一篇

猜你喜欢

热点阅读