how to convert comma separated string to list in python code example
Example 1: python list comma separated string
hobbies = ["basketball", "football", "swimming"]
print("My hobbies are:") # My hobbies are:
print(", ".join(hobbies)) # basketball, football, swimming
Example 2: string to list in python comma
# input comma separated elements as string
str = str (raw_input ("Enter comma separated integers: "))
print "Input string: ", str
# conver to the list
list = str.split (",")
print "list: ", list