編碼和Python的bytearray , bytes

unicode    是  編碼規範          ===》 http協議


GBK UTF-8  是 字符集  編碼方法   ===》 Apache  nginx


Python 3.X

bytes 和 str 的區別在於bytes是byte的序列,而str是Unicode的序列



http://www.asciitable.com/

b'6'.hex()  ==>  16進制

‘36’


int(b'6'.hex(), 16)  ==>  10 進制

54


b1 = b'1234'

b2 = bytearray(b1)


b2

Out[27]: bytearray(b'1234')


b2[0] = int(b'6'.hex(), 16)

b2

Out[29]: bytearray(b'6234')


bytes(b2)

Out[31]: b'6234'


b1 = bytes(b2)

b1

Out[33]: b'6234'







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章