Problems with readlines()

Christian Maus maus at netz.klinik.uni-mainz.de
Fri Jun 15 06:07:10 EDT 2001


hello there,

i wrote a function readfile() which reads all lines in a file and stores 
them in an array.

   infile = open('/tmp/tacfile', 'r')
   array = infile.readlines()
   infile.close()
   return array

the strange thing is, the more often I call this function, the lines read 
by it decrease, e.g I have a file containing 838 lines, i get 838 lines, 
then 738 lines, then 624 and so on...

When I simply do cut and paste for this code in my program, everything 
works fine, only when I call it via it's functionname I get this strange 
effect.

Any idea what the problem might be?

best regards

christian



More information about the Python-list mailing list