This is how the output should look like in the text file
Ray Holt
5 5 0 0 100 15
Jessica Jones
12 0 6 6 50 6
Johnny Rose
6 2 0 4 20 10
Gina Linetti
7 4 0 3 300 15
The number is the result from the game that I have to create.
My question is, how can I write to the text file with both string and integer result ? I have tried this
def write_to_file(filename, player_list):
output = open(filename, "w")
for player in player_list:
output.write(str(player))
but the output is
Ray Holt 5 5 0 0 100 15Jessica Jones 12 0 6 6 50 6Johnny Rose 6 2 0 4 20 10Gina Linetti 7 4 0 3 300 15Khang 0 0 0 0 100 0
They are in 1 line
Please help me! Thanks a lot guys