+ 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']
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 :)