python 2.7 - Obtain progress in reading large text file -


i have large text file (several gb in size) need read python , process line line.

one approach call data=f.readlines() , process content. approach know total number of lines , can measure progress of processing. not ideal approach given file size.

the alternative (and think better) option say:

    line in f:       

just not sure how measure progress anymore. there option not add huge overhead? (one reson why may want know progress 1 have rough indicator of remaining time, lines in file have similar sizes, , ascertain whether script still doing or has gotten stuck somewhere.)

if using linux os there way out seems.

a = os.popen("wc -l some.txt") f = a.read() 

on reading number of lines name of file


Comments

Popular posts from this blog

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -