Write a python function to append text to a user provided file


Topic: Write a python function to append text to a user provided file

Solution

def file_read(fname):
    with open(fname, "w") as myfile:
      myfile.write("Appending line one\n")
      myfile.write("Appending line two")
      txt = open(fname)
      print(txt.read())



List all Python Programs