In Ruby you can read from a file using s = File.read(filename). The shortest and clearest I know in Python is
s = File.read(filename)
with open(filename) as f: s =
Slow, ugly, platform-specific... but one-liner ;-)
import subprocess contents = subprocess.Popen('cat %s' % filename, shell = True, stdout = subprocess.PIPE).communicate()[0]