# define list of places
places = ['Berlin', 'Cape Town', 'Sydney', 'Moscow']
with open('listfile.txt', 'w') as filehandle:
for listitem in places:
filehandle.write('%s
' % listitem)
a_list = ["abc", "def", "ghi"]
f = open("a_file.txt", "w")
for item in a_list:
f.write(item + "
")
f.close()
all_sents = ['hey there', 'how are you']
with open('file_name.txt', 'w', encoding='utf-8') as f:
f.write('
'.join(all_sents))
#Salvar lista em .txt
with open('your_file.txt', 'w') as f:
for item in my_list:
f.write("%s
" % item)
dir /b>filelist.txt.