Are All Programming Languages The Same?

The python one-liner is:

print open("file.txt", 'r').read()

No need to iterate through the lines if you’re going to read them all in at once with .readlines() anyway. Add two or more lines for a try/except clause if you like.