how to get list from comma separated string in python code example
Example 1: how to split an input in python by comma
lst = input().split(',')
print (lst)
lst = input().split(' ; ')
print (lst)
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: how to get list from comma separated string in python
lst = []
d = dict()
user = input ("enter a string ::-- ")
lst = user.split(',')
print("LIST ELEMENR ARE :: ",lst)
l = len(lst)
for i in range(l) :
c = 0
for j in range(l) :
if lst[i] == lst[j ]:
c += 1
d[lst[i]] = c
print("dictionary is :: ",d)