python进行base64编解码

血红的双手。 提交于 2019-12-21 20:19:44

[转]

直接上代码

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.

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!