stripping

Edward Elliott nobody at 127.0.0.1
Tue May 2 15:06:52 EDT 2006


micklee74 at hotmail.com wrote:
> while 1:
>         line = f.readline().rstrip("\n")
>         if line == '':
>                 break
>         #if not re.findall(r'^$',line):
>         print line
 
you want continue, not break there.  but that gives you an infinite loop, so
you need a new exit condition.  you're better off scrapping the while and
using a for loop or list comprehension on readline.




More information about the Python-list mailing list