[Tutor] Problem reading large files in binary mode
Mirage Web Studio
admin at c12.in
Thu Jun 12 16:15:32 CEST 2014
Try reading the file in chunks instead:
CHUNKSIZE = 2**20
hash = hashlib.md5()
while True:
chunk = f.read(CHUNKSIZE)
if not chunk:
break
hash.update(chunk)
hashvalue = hash.hexdigest()
Thank you peter for the above valubale reply. but shouldn't read() by itself work because i have enough memory to load it or should it be a bug.
thank you
george
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
More information about the Tutor
mailing list