how to split an input in python by comma 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: python input comma separated values
lst = input().split(',')