python中的str对象其实就是"8-bit string" ,字节字符串,本质上类似java中的byte[]。 
而python中的unicode对象应该才是等同于java中的String对象,或本质上是java的char[]。 

 

str: s = "你好"

unicode: u = u"你好“

 

unicode转化为str,采用encode 编码:

str = u.encode('gbk')

 

str转化为unicode ,采用decode 解码:

unicode = s.decode('gbk')

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-28
  • 2021-11-15
  • 2022-12-23
  • 2021-12-22
  • 2022-01-21
  • 2022-12-23
  • 2021-09-19
相关资源
相似解决方案