take input by comma seperated strings 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 input comma separated int values in python

lst = list(map(int, input("Enter comma separated values: ").split(",")))