首页 > 其他 > 详细

2.10 读取打快数据文件

时间:2017-02-27 21:24:57      阅读:106      评论:0      收藏:0      [点我收藏+]
import sys

#filename = sys.argv[1]
filename=raw_input()
with open(filename,rb) as hugefile:
    chunksize =1000
    readable=‘‘

    while hugefile:
        start = hugefile.tell()
        print "starting at:", start
        file_block = ‘‘
        for _ in xrange(start, start+chunksize):
            line = hugefile.next()
            file_block = file_block + line
            print file_block, type(file_block), file_block
        readable = readable + file_block
        stop = hugefile.tell()
        print readable ,type(readable), readable
        print  reading bytes from %s to %s % (start, stop)
        print  read bytes total:,len(readable)

 

2.10 读取打快数据文件

原文:http://www.cnblogs.com/boooobao/p/6476126.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!