How to split a string by comma in Python

Splitting a string by comma returns a list of the strings between the commas in the original string. For example, splitting “ab,cde,f” by comma results in [“ab”, “cde”, “f”].

Solution for How to split a string by comma in Python : You can use str.split() to split a string by comma Use str.split(sep) with sep as “,” to return a list of the strings between commas in str.


how-to-split-a-string-by-comma-in-python