file = open("msg.txt", "w") file.write("my first file ") file.write("This file ") file.write("contains three lines ") file.close()