标签:style blog color os 文件 2014
#coding=gbk ‘‘‘ Created on 2014-5-7 ‘‘‘ import os.path inputPath = ‘./input.txt‘ outPath = ‘./out.txt‘ bufferSize = 10 inputFile = open(inputPath, ‘rb‘) outFile = open(outPath, ‘wb+‘) fileSize = os.path.getsize(inputPath) readedSize = 0 while readedSize < fileSize - bufferSize : tmp = inputFile.read(bufferSize) outFile.write(tmp) readedSize = readedSize + bufferSize #读取剩下的部分 tmp = inputFile.read(fileSize % bufferSize) outFile.write(tmp) inputFile.close() outFile.close() print ‘done‘
标签:style blog color os 文件 2014
原文地址:http://www.cnblogs.com/kisstherain/p/3850442.html