file = open("testfile.txt","w") file.write("Hello World\n") file.write("This is our new text file\n") file.write("and this is another line.\n") file.write("Why? Because we can.") # \n - dodaje novi redak # \t - tabovi, pogodno za excel datoteke file.close()