convert string to list python
# To split the string at every character use the list() function word = 'abc' L = list(word) L # Output: # ['a', 'b', 'c'] # To split the string at a specific character use the split() function word = 'a,b,c' L = word.split(',') L # Output: # ['a', 'b', 'c']
string to list python
# Python code to convert string to list def Convert(string): li = list(string.split(" ")) return li # Driver code str1 = "Geeks for Geeks" print(Convert(str1))
Source: www.geeksforgeeks.org