python - Converting range of numbers with respective ASCII codes -


how convert set of values characters

every number in range should converted , returned

without using control statements , loops

 eg: range(97,100) should converted {'a','b','c'} 

try this:

>>> map(chr, range(97,100)) ['a', 'b', 'c'] 

use of char:

>>> chr(97) 'a' 

using list comprehension:

>>> [chr(x) x in range(97,100)] ['a', 'b', 'c'] 

to in unicode use unichr:

>>> [unichr(x) x in range(97,100)] [u'a', u'b', u'c'] 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -