Answers for "how to save a list in a text file in python"

1

list to text file python

with open('your_file.txt', 'w') as f:
    for item in my_list:
        f.write("%sn" % item)
Posted by: Guest on January-05-2021
0

write text in list to text file python

all_sents = ['hey there', 'how are you']
with open('file_name.txt', 'w', encoding='utf-8') as f:
   f.write('n'.join(all_sents))
Posted by: Guest on October-15-2021

Code answers related to "how to save a list in a text file in python"

Python Answers by Framework

Browse Popular Code Answers by Language