[Tutor] list problem

Michael Lange klappnase at freenet.de
Wed Feb 21 11:18:33 CET 2007


On Wed, 21 Feb 2007 21:21:26 +1300
"John Fouhy" <john at fouhy.net> wrote:

> > Kirk Bailey wrote:
> > > ok, here comes some code:
> > >
> > > f1=open(pagename,'r')
> > > page=f1.readlines()
> > > f1.close()
> > >
> > > at the end of which, the data is in page, which is a list. But
> > > something strange is going on here. all the data is in a single cell!
> > > it's a one cell list! Say what?
> 
> Have you tried looking at pagename in a text editor?  If readlines()
> is returning only one line, then you should be able to spot that in
> the file.
> 

Just a guess: if the behavior changed in between Python-2.3 and 2.5 ,
maybe it is an issue with line endings, LF vs. CR-LF ?

Michael


More information about the Tutor mailing list