Using open method:
We open files with the open method and read file contents using the read method.
Note: With context handles the closing of the file is done automatically so you don’t need to close explicitly.
def readAFile(path):
with open(path, 'r') as f: #f is file descriptor
return f.read()
readAFile(path)