python - 在 Python 3 中打印不带 b' 前缀的字节

标签 python string python-3.x

如何在 Python 3 中打印没有 b' 前缀的 bytes 字符串?

>>> print(b'hello')
b'hello'

最佳答案

使用解码:

>>> print(b'hello'.decode())
hello

关于python - 在 Python 3 中打印不带 b' 前缀的字节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16748083/

相关文章:

Python "While"循环和中断它们

python - 操作系统 X : python ctypes global variables

Python 静态属性

python - 如何在 python 中增加元组内部?

python - 打印两个列表中的值对

python - 按键对python中的计数器进行排序

python - 从 python 中的列表中删除所有整数

php - 如何让 in_array() 不区分大小写?

java - 如何获取两个字符串或两个字符之间的多个字符串

Java 对多个字符串执行相同的操作