赞
踩
python手册:
base64.decode(input, output)
Decode the contents of the binary input file and write the resulting binary data to the output file. input and output must be file objects. input will be read until input.readline() returns an empty bytes object.
解码二进制输入文件,并写入解码后的二进制数据到输出文件。输入将会读到input.readline()返回一个空的bytes对象。
import base64 import os current_path = os.path.dirname(__file__) if __name__ == '__main__': # 打开文件 file1 = current_path + "\\doc\\form" file2 = current_path + "\\doc\\later.png" f1 = open(file1,"rb") f2 = open(file2,"wb") # base64.encode(f1,f2) base64.decode(f1,f2) f1.close() f2.close()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。