On Apr 7, 11:40 pm, John Nagle <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I want to iterate through the lines of a file in a recursive function
> > so I can't use:-
>
> > f = open(listfile, 'r')
> > for ln in f:
>
> > because when the function calls itself it won't see any mo
[EMAIL PROTECTED] wrote:
> I want to iterate through the lines of a file in a recursive function
> so I can't use:-
>
> f = open(listfile, 'r')
> for ln in f:
>
> because when the function calls itself it won't see any more lines in
> the file. E.g. more fully I want to do somthing like:
On Apr 7, 2:09 pm, [EMAIL PROTECTED] wrote:
> Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> > def recfun(lines):
> > for line in lines:
> > # Do stuff
> > if condition:
> > recfun(lines)
>
> > lines = iter(open(filename))
> > recfun(lines)
>
> Does that work though?
En Mon, 07 Apr 2008 10:09:13 -0300, <[EMAIL PROTECTED]> escribió:
> Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> def recfun(lines):
>> for line in lines:
>> # Do stuff
>> if condition:
>> recfun(lines)
>>
>> lines = iter(open(filename))
>> recfun(lines)
>>
> Does
[EMAIL PROTECTED] wrote:
> Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> You could use an iterator over the lines of the file:
>>
>> def recfun(lines):
>> for line in lines:
>> # Do stuff
>> if condition:
>> recfun(lines)
>>
>> lines = iter(open(filename))
>> re
Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> On Apr 6, 4:40 pm, [EMAIL PROTECTED] wrote:
> > I want to iterate through the lines of a file in a recursive function
> > so I can't use:-
> >
> > f = open(listfile, 'r')
> > for ln in f:
> >
> > because when the function calls itself it won't s
On Apr 6, 4:40 pm, [EMAIL PROTECTED] wrote:
> I want to iterate through the lines of a file in a recursive function
> so I can't use:-
>
> f = open(listfile, 'r')
> for ln in f:
>
> because when the function calls itself it won't see any more lines in
> the file. E.g. more fully I want to
I want to iterate through the lines of a file in a recursive function
so I can't use:-
f = open(listfile, 'r')
for ln in f:
because when the function calls itself it won't see any more lines in
the file. E.g. more fully I want to do somthing like:-
def recfun(f)
while True: