[Tutor] How to skip to next line in for loop

Kent Johnson kent37 at tds.net
Fri May 2 17:21:27 CEST 2008


On Fri, May 2, 2008 at 10:34 AM, Brain Stormer <brnstrmrs at gmail.com> wrote:
> f=open('file.txt',r)
>  position =False
>
>  for line in f.read().split():

Note that split() splits on any whitespace, not just line endings. In
your case it doesn't much matter I guess.

Kent


More information about the Tutor mailing list