Read
The read method used to read entire content or
specified number of characters from the opened.
Keyword:
read ()
Syntax:
file_object.read([size])The optional parameter 'size' specifies the number of characters to be read at a time. If we omit the parameter, the entire content of the file will be read.
Program:
# Open the file for reading
file = open("example.txt", "r")
# Read the contents of the file
contents = file.read()
# Print the contents to the console
print(contents)
# Close the file
file.close()
More topic in Python