f = open("test.txt", "w") f.writelines(["Hello", "World"]) f.close
f = open("test.txt", "w") f.write("Hello \nWorld") f.close