[Tutor] lst file

Remco Gerlich remco at gerlich.nl
Thu Jan 24 11:54:04 CET 2008


Many things could be wrong; perhaps with reading the file, or the lines, or
with printing them... Debugging usually consists of what the problem is
exactly, where it occurs.

First thing I'd look at is seeing whether the lines do get read. I would
change "print line" into "print len(line)" and see if the lines are empty,
or filled with unprintable things.

Also, what sort of file is it?

Remco


On Jan 24, 2008 11:42 AM, SwartMumba snake <swartmumba at yahoo.com> wrote:

> Hi
>
> I am trying to read from  a specific .lst file. When I read from it, it
> just prints out blank lines and I am sure that this file contains content.
>
> This is what I am using to read from the file:
>
> f = open("C:\\Users\\UserName\\Directory\\words.lst")
>
> for line in f:
>     print line
>
> f.close()
>
> Do you guys know what is wrong?
>
> Thanks in advance.
>
> ------------------------------
> Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080124/7d98c7ec/attachment.htm 


More information about the Tutor mailing list