Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python write list to file

data = [1,2,3,4,5]
with open('myfile.txt', 'w') as f:
    f.writelines([f"{x}
" for x in data])
Source by stackabuse.com #
 
PREVIOUS NEXT
Tagged: #python #write #list #file
ADD COMMENT
Topic
Name
4+1 =