Paul Rubin wrote:
> "dcrespo" <[EMAIL PROTECTED]> writes:
> 
>>>>>hex(255)[2:]
>>
>>'ff'
> 
> 
> '%x'%255 is preferable since the format of hex() output can vary.  Try 
> hex(33**33).

?

You're usually smarter than this, or am I missing some joke?

  >>> hex(33*33)
'0x441'
  >>> hex(33*33)[2:]
'441'
  >>> 33*33
1089
  >>> "%x" % 1089
'441'
  >>>

Of course, you have to watch out for operator precedence:

  >>> "%x" % 33*33
'212121212121212121212121212121212121212121212121212121212121212121'

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to