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

Leave a comment

Your comment