banbanbai 发表于 2018-8-7 13:42:01

编码和Python的bytearray , bytes

  unicode    是编码规范          ===》 http协议
  GBK UTF-8是 字符集编码方法   ===》 Apachenginx
  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: bytearray(b'1234')
  b2 = int(b'6'.hex(), 16)
  b2
  Out: bytearray(b'6234')
  bytes(b2)
  Out: b'6234'
  b1 = bytes(b2)
  b1
  Out: b'6234'
页: [1]
查看完整版本: 编码和Python的bytearray , bytes