I'm sort of mystified by the print hex to char conversion

grocery_stocker cdalten at gmail.com
Sat Apr 18 14:45:09 EDT 2009


I'm just really not seeing how something like x63 and/or x61 gets
converted by 'print' to the corresponding chars in the following
output...

[cdalten at localhost oakland]$ python
Python 2.4.3 (#1, Oct  1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print '\x63had'
chad
>>> print '\x63h\x61d'
chad
>>> print "\x63had"
chad
>>> print "\x63h\x61d"
chad
>>>

Does print just do this magically?



More information about the Python-list mailing list