Home >>Python File Methods >Python File read() Method
Python File read() Method is used to returns the specified number of n bytes size from the associated file. The whole file default value is -1.
Syntax:file.read()
Parameter | Description |
---|---|
size | It is Optional. Return the number of bytes. |
z = open("file1.txt", "r")
print(z.read())
x = open("file2.txt", "r")
print(x.read())