input comma seperated list 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: comma separated variables python

# What you describe is tuple assignment:
a, b = 0, 1

# The above is equivalent to:
a = 0
b = 1