a=”hello”和b=”世界”编码成bytes类型

a="hello"
c=a.encode(encoding='utf-8')
a = b'hello'

b="世界"
b = b.encode(encoding='utf-8')

print(a,b,c)

输出

b'hello' b'xe4xb8x96xe7x95x8c' b'hello'
[Program finished]
原文地址:https://www.cnblogs.com/sea-stream/p/11190571.html