+ 1

Input from string to list

Is there a way in python to ask for an input and turn it into a list. For example: ask for a name and turn 'John' into J,o,h,n? I assume it can be done, but is there some simple command to do it directly when receiving the or does it take something more complex after the input is entered?

19th Mar 2018, 12:03 AM
Wildcat Math
Wildcat Math - avatar
1 Answer
+ 5
s = "John" l = list(s) print l # ['J','o','h','n']
19th Mar 2018, 12:08 AM
Vladi Petrov
Vladi Petrov - avatar