python split comma separated string to list 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: split a string by comma in python
str = 'apple,orange,grape'
#split string by ,
chunks = str.split(',')
print(chunks)