Problems with readlines()

Emile van Sebille emile at fenx.com
Fri Jun 15 09:22:23 EDT 2001


I don't see how that function can return varied results.

Can you pare down the problem code to the smallest subset that exhibits the
problem and post that?  There's got to be something outside these four lines
contributing to this.

--

Emile van Sebille
emile at fenx.com

---------
"Christian Maus" <maus at netz.klinik.uni-mainz.de> wrote in message
news:9gcmt4$d28$1 at bambi.zdv.Uni-Mainz.DE...
> 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