how to convert comma separated string to list of string python code example
Example 1: how to split an input in python by comma
lst = input().split(',')#can use any seperator value inside '' of split
print (lst)
#given input = hello,world
#output: ['hello', 'world']
#another example
lst = input().split(' ; ')#can use any seperator value inside '' of split
print (lst)
#given input = hello ; world ; hi there
#output: ['hello', 'world', 'hi there']
Example 2: how to separate a string or int with comma in python
string = input('Input')
>>> 1,2
print(cord.split(','))
>>>['1', '2']
Example 3: convert list to string separated by comma python
converted_list = [str(element) for element in a_list]