- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile_read().py
More file actions
Latest commit
25 lines (17 loc) · 580 Bytes
/
Copy pathFile_read().py
File metadata and controls
25 lines (17 loc) · 580 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Python File read() Method
# Example
# Read the content of the file "demofile.txt":
f=open("demofile.txt", "r")
print(f.read())
# Definition and Usage
# The read() method returns the specified number of bytes from the file. Default is -1 which means the whole file.
# Syntax
# file.read()
# Parameter Values
# Parameter Description
# size Optional. The number of bytes to return. Default -1, which means the whole file.
# More examples
# Example
# Read the content of the file "demofile.txt":
f=open("demofile.txt", "r")
print(f.read(33))