Python not creating file -
i'm trying write text file in python. file doesn't yet exist i'm using: def writetotextfile(players): file = open('rankings.txt', 'a') player in players: file.write(player.name, player.rating, player.school, '\n') file.close() i used 'a' append , thought create new file (based on documentation). on desktop (where i'm running script from) , there's no "rankings.txt" file found. any thoughts on how fix? thanks, bclayman the syntax write command incorrect. function accepts string argument. example: file.write("{}, {}, {}\n".format(player.name, player.rating, player.school)) i've mocked quick example of full script show in action: class player(object): def __init__(self, name, rating, school): self.name = name self.rating = rating self.school = school def writetotextfile(players): f = open('rankings.txt', 'a') ...