Write a list to a file : writelines « File « Python Tutorial






wordList = ["Red", "Blue", "Green"]
filePath = "output.txt"

file = open(filePath, 'wU')
file.writelines(wordList)
file.close()








12.17.writelines
12.17.1.Write lines
12.17.2.Write a list to a file