Created
July 6, 2023 15:40
-
-
Save aarong1/5c925d8cc87e2fe7dc7b8c21cbaf368a to your computer and use it in GitHub Desktop.
easy read file wrapping the context handler and closing the connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_file(filename): | |
with open(filename, 'r') as f: | |
content = f.read() | |
f.close() | |
return content | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment