a_list = ["abc", "def", "ghi"] textfile = open("a_file.txt", "w") for element in a_list: textfile. write(element + " ") textfile. close()