1. Using write method:
#!/usr/bin/python
l1=['hi','hello','welcome']
f=open('f1.txt','w')
for ele in l1:
f.write(ele+'\n')
f.close()
The list is iterated, and during every iteration, the write method writes a line to a file along with the newline character.