From 4329015e2f1c14edab4ccbc65287e937e5b14bdf Mon Sep 17 00:00:00 2001 From: DarkCodeOrg Date: Wed, 11 Aug 2021 13:12:59 +0530 Subject: [PATCH] new uploads --- file_handling.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/file_handling.py b/file_handling.py index e69de29..d2cb98e 100644 --- a/file_handling.py +++ b/file_handling.py @@ -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