Skip to content

Instantly share code, notes, and snippets.

@xavismeh
Created October 5, 2015 15:48
Show Gist options
  • Save xavismeh/bd0c3073021c8427a062 to your computer and use it in GitHub Desktop.
Save xavismeh/bd0c3073021c8427a062 to your computer and use it in GitHub Desktop.
import os
filename = 'my_file.txt'
filesize = os.path.getsize(filename)
b_read = 0
f = open(filename, 'r')
# read n bytes and perform action
# ...
b_read += n
print b_read*100/filesize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment