TypeError: 'str' does not support the buffer interface

后端 未结 7 817
南方客
南方客 2020-11-22 03:11
plaintext = input(\"Please enter the text you want to compress\")
filename = input(\"Please enter the desired filename\")
         


        
7条回答
  •  一生所求
    2020-11-22 04:00

    For Python 3.x you can convert your text to raw bytes through:

    bytes("my data", "encoding")
    

    For example:

    bytes("attack at dawn", "utf-8")
    

    The object returned will work with outfile.write.

提交回复
热议问题