GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Friday, December 31, 2010

Reading File In Python

To read a text file, use:
fp = open("file.txt","r");
print fp.read()

For writing to a file, use:
fp = open("data.txt","w");
write("Hello World");
fp.close();
       
Share/Bookmark

No comments:

Post a Comment