Newbie completely confused
Roel Schroeven
rschroev_nospam_ml at fastmail.fm
Tue Sep 25 08:36:54 EDT 2007
Roel Schroeven schreef:
> import time
>
> input_files = ["./test_file0.txt", "./test_file1.txt"]
>
> total_start = time.time()
> data = {}
> for input_fn in input_files:
> file_start = time.time()
> f = file(input_fn, 'r')
> data[input_fn] = f.read()
> f.close()
> file_done = time.time()
> print '%s: %f to read %d bytes' % (input_fn, file_done -
> file_start, len(data))
... that should of course be len(data[input_fn]) ...
> total_done = time.time()
> print 'all done in %f' % (total_done - total_start)
>
>
> When I run that with test_file0.txt and test_file1.txt as you described
> (each 30 MB), I get this output:
>
> ./test_file0.txt: 0.260000 to read 1 bytes
> ./test_file1.txt: 0.251000 to read 2 bytes
> all done in 0.521000
... and then that becomes:
./test_file0.txt: 0.290000 to read 33170000 bytes
./test_file1.txt: 0.231000 to read 33170000 bytes
all done in 0.521000
--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov
Roel Schroeven
More information about the Python-list
mailing list