python內(nèi)置函數(shù) 我怎樣才能把字節(jié)轉(zhuǎn)換成Python中的字符串?
我怎樣才能把字節(jié)轉(zhuǎn)換成Python中的字符串?#bytes object b=b “example ”#str object s=“example ”#str to bytes bytes(s,enc
我怎樣才能把字節(jié)轉(zhuǎn)換成Python中的字符串?
#bytes object b=b “example ”#str object s=“example ”#str to bytes bytes(s,encoding=“utf8”)#bytes to str str(b,encoding=“utf-8”)#另一種方法#str to bytesstr.encode編碼(s) #字節(jié)到字符串字節(jié).解碼(二)