How to convert a comma-separated string to a list in Python

A comma-separated string is a string with values separated by commas. Converting a comma-separated string to a list creates a list with each value as an element. For example, converting “a,b,c” to a list results in [“a”, “b”, “c”].

Solution for How to convert a comma-separated string to a list in Python : You can use str.split() to convert a comma-separated string to a list Call str.split(sep) with “,” as sep to convert a comma-separated string into a list.


how-to-convert-a-comma-separated-string-to-a-list-in-python