[Tutor] output question

Alan Gauld alan.gauld at freenet.co.uk
Sat Nov 12 13:53:23 CET 2005

>    fsock = open("c:/TEMP/hello.txt")

This opens the file ready for you to read it.
Thats all. You need to tell Python what you want to do with the file now 
that you've opened it.

> why it does not show on the output.

To display the contents you need

print fsock.read()

Have a look at the Handling Files topic in my tutorial for more options,

Alan G
Author of the learn to program web tutor

More information about the Tutor mailing list