Reputation: 853
Alright I am trying to gather x, y coordinates as you all know and I am working on the save feature to save the x, y's to a text file. here is what I got
x1 = raw_input("What is x1: ")
y1 = raw_input("What is y1: ")
x2 = raw_input("what is x2: ")
y2 = raw_input("what is y2: ")
outFile = open("c:\\users\zilvarael\Desktop\coord_man.txt", "wt")
outFile.write("Coordinate file: \n", x1, y1, "\n", x2, y2)
Here is the error I am facing:
outFile.write("Coordinate file: \n", x1, y1, "\n", x2, y2)
TypeError: function takes exactly 1 argument (6 given)
Any idea how to fix this?
Upvotes: 1
Views: 1181
Reputation: 142256
.write
only takes one argument, format the string first:
outFile.write("Coordinate file: \n {} {} \n {} {}".format(x1, y1, x2, y2))
Upvotes: 2