Python Program to demonstrate file operations like read, append, write.
#Python Program to demonstrate file operations like read, append, write. readWRITE = 'w+' READ = 'r' Append = 'a' list0 = [] def create(): file = input("Enter name for a file: ") filename = (file+".txt") f = open(filename, readWRITE) N = int(input("Enter number of lines you want to print:")) for i in range (N): data = input("%d:"% i) list0.append(data) for i in range(N): f.write(list0[i]+"\n") f.close() print("File Written successfully.") def read(): filename = input("\nEnter name of a file with extension that you want to open:") print("\ncontent of the file is:\n") f = open(filename, READ) ...