-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileHandling.py
More file actions
30 lines (27 loc) · 912 Bytes
/
FileHandling.py
File metadata and controls
30 lines (27 loc) · 912 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
25
26
27
28
29
30
# Isha Bule UCE2021610
# File handling
newFile = open("File_Handling.py", 'w')
newFile.write("This is the python program on file handling...")
newFile = open("File_Handling.py", 'r')
print(newFile.readline())
newFile = open("File_Handling.py", 'w')
newFile.writelines("Hello "
"hello "
"this is multiline code")
newFile = open("File_Handling.py", 'r')
print(newFile.readline())
newFile.close()
new = open("File_Handling.py", 'r')
for x in new:
print(x) # reading all the lines one by one
new.seek(10) # seek data after position 10
print(new.readline())
print("position of cursor", new.tell()) # tell function returns position of cursor
'''
*******OUTPUT**********
This is the python program on file handling...
Hello hello this is multline code
Hello hello this is multline code
o this is multline code
position before readline 33
'''