DAY8

File Handling

file=open("sample.txt","r")
print(file.read())
file.close()

Write & Append

open("sample.txt","w")
open("sample.txt","a")

with Statement

with open("sample.txt","r") as f:
 print(f.read())

Exceptions

except FileNotFoundError:
 print("File not found")