The read method
The read method reads a file and returns its contents. The optional parameter of the method can specify the number of bytes of the file that we need to read.
Syntax
file.read([number of bytes in a file])
Example
Let's open the file file.txt using the open function, and then read its contents:
res = open('file.txt', 'r')
print(res.read())
The result of the executed code:
text