Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: read the entire contents of a file at once

Python: read the entire contents of a file at once
{filelink=16180}

myFile = "c:/test.txt"
#Read entire file into a buffer
buffer = "buffer contains:
"
buffer += open(myFile, 'rU').read()
# show file's content
print buffer

Users who found this page were searching for:

  • perl hashcode
  • java how to output inputsource
  • python pi math

No comments yet.

Leave a Comment