Reading a file in Python

Source code for reading a file in Python:

file=open(’2.txt’,'r’)

file1=file.read()

file.close

to see the contents of the read  file simply use

print file1

This entry was posted on Monday, July 28th, 2008 at 2:04 am and is filed under Python. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post a Comment