get list from string python code example
Example 1: python list to string
mystring = 'hello, world'
mylist = string1.split(', ') #output => ['hello', 'world']
myjoin1 = ', '.join(mylist) #output => 'hello, world'
myjoin2 = ' '.join(mylist) #output => 'hello world'
myjoin3 = ','.join(mylist) #output => 'hello,world'
Example 2: print string elements in list python
# list having all elements are strings
strings = ['string1', 'string2', 'string3', 'string4']
for string in strings:
print(string)