Please explain the following:
def feed(data):
import os
print "DATA LEN: %s" % len(data)
f = open("copy", "w")
f.write(data)
f.close()
print "FILE LEN: %s" % os.stat("copy").st_size
t = tempfile.NamedTemporaryFile()
t.write(data)
print "TEMP LEN: %s" % os.stat(t.name).st_size
t.close()
feed(x)
DATA LEN: 11004
FILE LEN: 11004
TEMP LEN: 8192
Why the difference, and can I fix temp? The end seems to be chopped.
Tested on 2.6, 2.7