how to make a text file with python then edit it code example Example: python edit text file with open("foo.txt", "a") as f: f.write("new line\n")