[转]

直接上代码

import base64
fin = open(r"D:\2.zip", "rb")
fout = open(r"D:\2.x.txt", "w")
base64.encode(fin, fout)
fin.close()
fout.close()

fin = open(r"D:\2.x.txt", "r")
fout = open(r"D:\2.x.zip", "wb")
base64.decode(fin, fout)
fin.close()
fout.close()

另外

    decode(input, output)
        Decode a file.
    
    decodestring(s)
        Decode a string.
    
    encode(input, output)
        Encode a file.
    
    encodestring(s)
        Encode a string into multiple lines of base-64 data.

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2021-11-21
  • 2021-12-31
  • 2021-07-20
  • 2022-12-23
  • 2023-03-18
相关资源
相似解决方案