How do I break an input into individual characters in python? -
this question has answer here:
- convert string (without separator) list 9 answers
i able take input a-z or 0-9 , of indefinite quantity of characters , put them list. here example of code envisioning.
number = input() num_list = break_string(number) print num_list
use list comprehension when need turn iterable (string in case) list:
print([c c in "hello"]) ['h' 'e' 'l' 'l' 'o']
each character considered element of string. part before for
what's put new list. in case, it's taking character , putting list unchanged.
Comments
Post a Comment