a = '\xe4\xb8\xad\xe5\x9b\xbd'
aa = a.encode('raw_unicode_escape')
print(aa) # 结果:b'\xe4\xb8\xad\xe5\x9b\xbd'
aaa = aa.decode()
print(aaa) #结果 中国
a = '\xe4\xb8\xad\xe5\x9b\xbd'
aa = a.encode('raw_unicode_escape')
print(aa) # 结果:b'\xe4\xb8\xad\xe5\x9b\xbd'
aaa = aa.decode()
print(aaa) #结果 中国
转载于:https://www.cnblogs.com/chaihy/p/11044343.html