Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions file_handling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from os import read

# file reading
file = open('trial.txt' , 'r')

for each in file:
print(each)

print (file.read())

# file writing

file.write("this is the write function")
file.write("this lets us write to the file")
file.close # the close function lets us close all the resources in use


## Append mode

file = open('trial.txt','a')

file.write("writing this in append mode")
file.close