python 字符串转换成字节的三种方式

 

str='zifuchuang'

第一种

b'zifuchuang'

第二种

bytes('zifuchuang',encoding='utf-8')

第三种

('zifuchuang').encode('utf-8')

 

posted @ 2019-01-24 15:51  anobscureretreat  阅读(946)  评论(0编辑  收藏  举报