Python语言处理整个文件的base64编码解码源码共享
来源:互联网 发布:淘宝联盟手机app 编辑:程序博客网 时间:2024/05/22 01:26
#! /usr/bin/env python#coding=utf-8#version 2.7import timeimport base64import sys# global variant GLOBAL_INPUT_PATH="1.txt"GLOBAL_OUTPUT_PATH="2.txt"#convert file stream to base64 and save to filedef Base64EncodeFileToFile(inputFile,outputFile): fread = open(inputFile, 'rb') fwrite= open(outputFile, 'wb') base64.encode(fread,fwrite) fread.close() fwrite.close() #decode file stream to orginal and save to filedef Base64DecodeFileToFile(inputFile,outputFile): print('[%s]' %(time.strftime('%X'))) fileRead= open(inputFile, 'rb') fileWrite = open(outputFile, 'wb') base64.decode(fileRead, fileWrite) fileRead.close() fileWrite.close() print('[%s]' %(time.strftime('%X')))# main entrydef Usage_Function(): print("\tinputfile outputfile") if __name__ == '__main__': print('Main Thread Run :', __name__) if(len(sys.argv)==3): try: GLOBAL_INPUT_PATH = sys.argv[1].strip() GLOBAL_OUTPUT_PATH =sys.argv[2].strip() Base64EncodeFileToFile(GLOBAL_INPUT_PATH,GLOBAL_OUTPUT_PATH) #Base64DecodeFileToFile(GLOBAL_INPUT_PATH,GLOBAL_OUTPUT_PATH) except IOError: print ('IOError: arguments is error!\n') Usage_Function() exit() else: Usage_Function() time.sleep(1) print('Main Thread Exit :', __name__)
0 0
- Python语言处理整个文件的base64编码解码源码共享
- python Base64 编码解码
- base64编码解码的实现(C语言)
- base64编码解码的实现(C语言)
- Base64编码解码的实现(C语言)
- Base64编码解码的实现(C语言)
- base64编码、解码的C语言实现
- base64编码、解码的C语言实现
- base64编码、解码的C语言实现
- base64编码、解码的C语言实现
- BASE64编码、解码的C语言实现
- Base64编码/解码Delphi源码
- Base64编码/解码Delphi源码
- Base64编码/解码Delphi源码
- 共享一个在线base64解码编码的地址 好用
- python 解码base64编码邮件
- Python 和 VBScript 对文件编码-解码的方式 (Hex, Base64) 的疑问
- mht文件解码,base64编码解码
- 症状:可以上网,可以上QQ,不能登陆360安全卫士,360浏览器无法同步,有道词典等无法登陆,无法查询。
- maven项目打包为含依赖的可执行jar
- 向量模板
- leetcode Kth Largest Element in an Array
- Ant开篇之安装
- Python语言处理整个文件的base64编码解码源码共享
- 五种马斯洛需求理论演变
- 获取文件创建时间时获取不到的解决方法
- C++11的enum class & enum struct和enum
- NYOJ 3 多边形重心问题 (求多面性重心及面积)
- 异步加载图片,实现图文混排
- UIView及其子类
- 19_Java 方法
- Android性能优化