xor on strings
dsavitsk at e-coli.net
Mon Feb 11 07:49:22 CET 2002
thanks, i appreciate the help.
"Jason Orendorff" <jason at jorendorff.com> wrote in message
news:mailman.1013406617.24389.python-list at python.org...
> dsavitsk wrote:
> > >>> red = hex(56)[2:4]
> > >>> green = hex(156)[2:4]
> > >>> blue = hex(12)[2:4]
> > >>> thestring = '&H' + blue + green + red
> > but here, since the blue string is only 1 character it throws the
> > rest off.
> >>> colors = (56, 156, 12)
> >>> print '&H%02x%02x%02x' % colors
> If you would prefer to have a function instead,
> you can use string.zfill().
> ## Jason Orendorff http://www.jorendorff.com/
More information about the Python-list