On 29May2013 13:14, Ian Kelly <ian.g.ke...@gmail.com> wrote:
| On Wed, May 29, 2013 at 12:33 PM, alcyon <st...@terrafirma.us> wrote:
| > This notation displays hex values except when they are 'printable', in 
which case it displays that printable character.  How do I get it to force hex 
for all bytes?  Thanks, Steve
| 
| Is this what you want?
| 
| >>> ''.join('%02x' % x for x in b'hello world')
| '68656c6c6f20776f726c64'

Not to forget binascii.hexlify.
-- 
Cameron Simpson <c...@zip.com.au>

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.      - Sir Arther Eddington
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to