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'\xe4\xb8\x96\xe7\x95\x8c' b'hello'
[Program finished]

 

posted @ 2019-07-15 18:21  anobscureretreat  阅读(681)  评论(0)    收藏  举报