🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
``` str1 = '\u63a8\u8350' print(str1.encode('utf8').decode('unicode_escape')) print(str1.encode('utf8')) #print(s1.encode('utf8').decode('unicode_escape').encode('utf8')) print(str1.encode('utf8').decode('unicode_escape').encode('utf8')) str2 = '\\u63a8\u8350' str2 = '\\u63a8\\u8350' print(str2.encode('utf8').decode('unicode_escape')) str3 = 'b\n' str4 = 'b\\n' str4 = "b\\n" print('I\'m ok') str5 = '\\ub2e4\\uc6b4\\ub85c\\ub4dc' print(str2.encode('utf8').decode('unicode_escape')) print(str5.encode('utf8').decode('unicode_escape')) ``` ``` Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> str1 = '\u63a8\u8350' >>> print(str1.encode('utf8').decode('unicode_escape')) 推荐 >>> print(str1.encode('utf8')) b'\xe6\x8e\xa8\xe8\x8d\x90' >>> print(s1.encode('utf8').decode('unicode_escape').encode('utf8')) Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print(s1.encode('utf8').decode('unicode_escape').encode('utf8')) NameError: name 's1' is not defined >>> print(str1.encode('utf8').decode('unicode_escape').encode('utf8')) b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' >>> str2 = '\\u63a8\u8350' >>> str2 = '\\u63a8\\u8350' >>> print(str2.encode('utf8').decode('unicode_escape')) 推荐 >>> str3 = 'b\n' >>> str3 'b\n' >>> str4 = 'b\\n' >>> str4 'b\\n' >>> str4 = "b\\n" >>> str4 'b\\n' >>> print('I\'m ok' ) I'm ok >>> print(str4) b\n >>> print(str3) b >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' Traceback (most recent call last): File "C:/910/9101.py", line 4, in <module> print(s1.encode('utf8').decode('unicode_escape').encode('utf8')) NameError: name 's1' is not defined >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I m ok >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I 'm ok >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok \u63a8\u8350 >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok b'\\u63a8\\u8350' >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok 推荐 >>> ==================== RESTART: C:/910/9101.py ==================== 推荐 b'\xe6\x8e\xa8\xe8\x8d\x90' b'\xc3\xa6\xc2\x8e\xc2\xa8\xc3\xa8\xc2\x8d\xc2\x90' 推荐 I'm ok 推荐 다운로드 >>> ```