How do I break an input into individual characters in python? -


this question has answer here:

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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -