有时会报错这个:TypeError: Can't convert 'bytes' object to str implicitly

解决方法:使用字节码的decode()方法。

示例:

str = 'I am string'
byte = b' I am bytes'
s = str + byte
print(s)

  这时会报错:TypeError: Can't convert 'bytes' object to str implicitly

解决方法:

s = str + byte.decode()

  

 

相关文章:

  • 2022-12-23
  • 2022-01-14
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案