python3转义编码
s = 'dy电影' print(s) # dy电影 print(type(s)) # <class 'str'> print(s.encode('utf-8')) # b'dy\xe7\x94\xb5\xe5\xbd\xb1' print(s.encode('unicode_escape')) # b'dy\\u7535\\u5f71' print(s.encode('unicode_escape').decode('utf-8')) # dy\u7535\u5f71 s = 'dy\\u7535\\u5f71' print(s.encode('utf-8')) # b'dy\\u7535\\u5f71' print(s.encode('utf-8').decode('unicode_escape')) # dy电影 print(s.encode('unicode_escape')) # b'dy\\\\u7535\\\\u5f71'