# bytes object  
 b = b"example"  
  
 # str object  
 s = "example"  
  
 # str to bytes  
 bytes(s, encoding = "utf8")  
  
 # bytes to str  
 str(b, encoding = "utf-8")  
  
 # an alternative method  
 # str to bytes  
 str.encode(s)  
  
 # bytes to str  
 bytes.decode(b)  

 

相关文章:

  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-08
  • 2022-12-23
  • 2021-12-12
  • 2021-10-07
  • 2022-01-01
  • 2021-12-28
相关资源
相似解决方案