On Friday, May 17, 2013 8:50:26 AM UTC+5:30, lokesh...@gmail.com wrote:
> 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.
size = 50mb
--
http://mail.python.org/mailman/listinfo/python-list