File Create and Write.py

f = open("input.txt", "w")

f.write("My Name is Anik.\n")
f.write("My Phone Number is 01985946475\n")
f.write("My Section is 'B'")

f.close()

#here "x" extension check File exist or not if not exist it create a file
f = open("put.txt", "x")

f.write("File Successfully exist.")

f.close()

f = open("input.txt", "x")
f.close()

Comments