f = open("test.txt", "w") f.writelines(["Hello", "World"]) f.close
f = open("test.txt", "w") f.write("Hello World") f.close
f=open('output.txt', 'w') print("Hello world", file=f) f.close