xor on strings

Joshua Muskovitz joshm at taconic.net
Mon Feb 11 01:35:00 EST 2002


It isn't clear why you want to compare to '00', but this code should do the
trick nicely:

>>> (r,g,b) = (56,156,12)
>>> theString = '&H%02x%02x%02x' % (b,g,r) # note the order!
>>> theString
'&H0c9c38'

Is the test for '00' for anything other than the formatting of the string?
Are you trying to find the brightest color, or something?
--
# Joshua Muskovitz
# joshm at taconic.net
def lyyrs(sig): return '-'.join(sig.split()+["ly y'rs"])
lyyrs('Hire me!  I need the work!')




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list