码迷,mamicode.com
首页 > 其他好文 > 详细

2.10 读取打快数据文件

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

标签:xrange   tin   next   span   art   ble   lin   rom   start   

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 读取打快数据文件

标签:xrange   tin   next   span   art   ble   lin   rom   start   

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

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!