Easiest way to read/write a file’s content in Python

A one-liner. No reason to do this.

with open('x.py') as f: s = f.read()

Leave a Comment