+ 1

Question about lists

How can I make a list from given strings without spaces? ex: string='hey hi' my_list=list[string] then my_list will be ['h', 'e', 'y', ' ', 'h', 'i']

13th Dec 2018, 1:45 PM
씜혞쀀
1 Answer
+ 5
Hi 씜혞쀀 You want to make a list of the characters in your string? Just use the list() function: my_string = "spam" my_list = list(my_string) print(my_list) # Output: ['s', 'p', 'a', 'm'] Hope that helps :)
13th Dec 2018, 1:50 PM
Kishalaya Saha
Kishalaya Saha - avatar