Python Write To File Error: Lists -
i've been trying write 2 tuple lists i've created txt file called worldserieswinnersnd.txt however, though no error messages come when programme run, txt file remains unchanged. have tried several different ways tuples written file, 2 of illustrate below. please allow me know i'm missing.
def createfilenoduplicates(winnersnd, winstuple): wins_file = open('worldserieswinnersnd.txt', 'w') wins_file.write("\n".join(winnersnd)) wins_file.write("\n".join(winstuple)) wins_file.close()
and
def createfilenoduplicates(winnersnd, winstuple): wins_file = open('worldserieswinnersnd.txt', 'w') item in winstuple: wins_file.write('%s\n' % item) wins_file.close()
python list tuples items writetofile
No comments:
Post a Comment