The code below is to be used to iterate over some large .txts.
10 minutes to iterate over a 80MB file: is that what I should expect? Is there something fundamentally wrong with my approach?
print 'File size = ' + str(os.path.getsize(FullPath))
print time.gmtime()
with open(FullPath) as FileObj:
for lines in FileObj:
i +=1
print i
print time.gmtime()
OUTPUT:
File size = 80536606
time.struct_time(tm_year=2015, tm_mon=4, tm_mday=27, tm_hour=15, tm_min=16, tm_sec=6, tm_wday=0, tm_yday=117, tm_isdst=0)
140614
time.struct_time(tm_year=2015, tm_mon=4, tm_mday=27, tm_hour=15, tm_min=26, tm_sec=21, tm_wday=0, tm_yday=117, tm_isdst=0)
Based my code on these links: