Each time I start a new Python project, I define a read_file
method. Something like:
def read_file(file_name: str) -> List[str]:
with open(file_name) as f:
lines = f.readlines()
return lines
Usually, I also add a write_file
method.
Is there a Python package from which I can import a method with the same interface? If there isn't such a package I will create one :)
I want to emphasize that I'm aware of these solutions, but I want this exact interface because it is simpler.