I am trying to create a text file and write to it from a python list.
Code:
file1 = open("test.txt","w")
test_list = ['hi', 'hello', 'welcome']
for each_ele in test_list:
file1.write(each_ele+'\n')
file1.close()
Still the file is empty, any suggestions please?