[Tutor] Load Entire File into memory

Amal Thomas amalthomas111 at gmail.com
Mon Nov 4 17:56:30 CET 2013


@Steven: Thanks... Right now I cant access the files. I will send you the
output when I can.

------
Please try this little bit of code, replacing the file name with the
actual name of your 50GB data file:

import os
filename = "YOUR FILE NAME HERE"
print("File size:", os.stat(filename).st_size)
f = open(filename)
content = f.read()
print("Length of content actually read:", len(content))
print("Current file position:", f.tell())
f.close()


and send us the output.

-- 

*AMAL THOMAS*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131104/8886b1c4/attachment.html>


More information about the Tutor mailing list