Chrome Extension

Split string to list python

You can convert or split your string to a list in python using .split() method
my_str = "This is a string"
#output - ["This", "is", "a", "string"]

comma_str = "Apple, Banana, Orange"
print(comma_str.split(", "))
#output - ["Apple", "Banana", "Orange"]
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

In this code snippet, we convert a string to a list and split them using space and for the second variable, we split them using commas.

Was this helpful?
Open Code Manager We are hiring