I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? I had written the following code..
def create_file_numbers_old(filename, size):
start = time.clock()
value = 0
with open(filename, "w") as f:
while f.tell()< size:
f.write("{0}n".format(value))
value += 1
end = time.clock()
print "time taken to write a file of size", size, " is ", (end -start), "seconds n"
it takes about 20sec i need 5 to 10 times less than that.