[CentralOH] chr()/ord() Ugliness
michael at yanovich.net
michael at yanovich.net
Mon Nov 11 18:34:50 CET 2013
On 11/11/2013 12:27 PM, Eric Floehr wrote:
> 2. It will return different results based on your locale setting (which is
> why it was removed in Python 3. Changing constants are bad).
Interesting, I didn't know it changed based on locale.
So, I guess in a more general term, if one wanted a way to constantly access
letters A-Z it would probably be better to hard code a string like so?
In [1]: myupper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
or maybe,
In [8]: ''.join([chr(x) for x in range(65,65+26)])
Out[8]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
--
Michael Yanovich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/centraloh/attachments/20131111/9dd20379/attachment-0001.sig>
More information about the CentralOH
mailing list