xor on strings

dsavitsk dsavitsk at e-coli.net
Mon Feb 11 00:14:03 EST 2002


i didn't explain that well at all.  the point that i forgot to mention is
that i want to compare each hex'd number to '00' ... there remains the
problem of comparing  from the left instead of from the right,  maybe i
should have though about this a little more before i posted.

-d


"dsavitsk" <dsavitsk at e-coli.net> wrote in message
news:%hI98.3302$pC1.668524 at newssrv26.news.prodigy.com...
> the truncate part is the problem.  I am building VB Hex strings to send to
a
> VB server.  so
>
> >>> 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.
>
> -d
>
> "Joshua Muskovitz" <joshm at taconic.net> wrote in message
> news:3c674cbd_2 at corp.newsgroups.com...
> > Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> > >>> ''.join(map(max,zip('00','AA')))
> > 'AA'
> > >>> ''.join(map(max,zip('00','A')))
> > 'A'
> > >>> ''.join(map(max,zip('00','')))
> > ''
> >
> > Damn, I thought I had it.  :-)  Is there an variant of zip which doesn't
> > truncate?  BTW, this does work, provided that the input strings are the
> same
> > length, and even allows for more than two strings!
> >
> > >>> s = ['abte','scrt','sdfw','cxvs']
> > >>> ''.join(map(max,zip(*s)))
> > 'sxvw'
> >
> > --
> > # 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