python List[str] code example

Example 1: list to string python

List = ["ITEM1", "ITEM2", "ITEM3"]
string_version = "".join(List)

print(string_version)

Example 2: python array to string

mystring = 'hello, world'

myarray = string1.split(', ') #output => [hello, world]

myjoin1 = ', '.join(myarray) #output => hello, world
myjoin2 = ' '.join(myarray) #output => hello world
myjoin3 = ','.join(myarray) #output => hello,world

Example 3: print string elements in list python

# list having all elements are strings
strings = ['string1', 'string2', 'string3', 'string4']
for string in strings:
    print(string)