因为python的read和write方法的操作对象都是string。而操作二进制的时候会把string转换成list进行解析,解析后重新写入文件的时候,还得转换成string。

import string
str = 'abcde'
 list = list(str)
list
['a', 'b', 'c', 'd', 'e']
str
'abcde'
str_convert = ''.join(list)
str_convert
'abcde'

 

相关文章:

  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-10-01
  • 2021-10-25
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-12-24
  • 2022-12-23
相关资源
相似解决方案