Python get rid of bytes b' '

后端 未结 6 1443
悲&欢浪女
悲&欢浪女 2021-02-18 17:24
import save

string = \"\"

with open(\"image.jpg\", \"rb\") as f:
    byte = f.read(1)
    while byte != b\"\":
        byte = f.read(1)
        print ((byte))
<         


        
6条回答
  •  遥遥无期
    2021-02-18 17:40

    You can use bytes.decode function if you really need to "get rid of b": http://docs.python.org/3.3/library/stdtypes.html#bytes.decode

    But it seems from your code that you do not really need to do this, you really need to work with bytes.

提交回复
热议问题