[Tutor] lst file
Alan Gauld
alan.gauld at btinternet.com
Thu Jan 24 23:58:59 CET 2008
"SwartMumba snake" <swartmumba at yahoo.com> wrote
> 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.
Wjat kind of content? Have you opened it in a text editor and
looked at it? You are reading the file as text but if its binary
data it may not be printable. Or the file may reach an EOF
character before encountering any printavble characters.
> 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()
It should work if its a text file with printable content.
Alan G
More information about the Tutor
mailing list