get a list printed in hexadecimal notation

François Pinard pinard at iro.umontreal.ca
Wed Jul 17 13:38:26 EDT 2002


[Harvey Thomas]

> print  [type(x) == type(1) and hex(x) or x for x in l]

A tiny detail.  I guess that `type(x) == type(1)' is better written
`isinstance(x, int)' under Python 2.2.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list