[Tutor] output question

Liam Clarke ml.cyresse at gmail.com
Sat Nov 12 11:54:14 CET 2005


Sorry Shi Mu, don't understand the question.

So, you're successfull opening a file. Now, you need to read it

for line in fsock:
    print line

or

fsockData = fsock.read()

or

nextLine = fsock.readline()

Have a play with those.
On 11/12/05, Shi Mu <samrobertsmith at gmail.com> wrote:
> I got the output as:
> >>>
> Yes!!! This line will always print
> from the code:
> try:
>     fsock = open("c:/TEMP/hello.txt")
> except IOError:
>     print "The file does not exist, exiting gracefully"
> print "Yes!!! This line will always print"
>
> it means the code found there is hello.txt,
> why it does not show on the output.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list