with open("hello.txt", "w") as f: f.write("Hello World") #using With Statement files opened will be closed automatically