Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert python list to text file

# 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)
 
PREVIOUS NEXT
Tagged: #convert #python #list #text #file
ADD COMMENT
Topic
Name
6+8 =