make a string from a list 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: how to convert a string to a list python

#How to split a string into a list (Python)

#"separator" should be replaced with the string you want to split with
string.split("separator")

Tags:

Java Example