"Demel, Jeff" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
John Salerno wrote:
P.S.  How about a string.shuffle() method that splits the string in half
into two new strings str1 and str2, and then recompiles the string by
alternating one character from each str1 and str2 as it goes?  Like
shuffling cards.  ;)


You mean:

"".join(sum(map(list,zip(s,s[len(s)/2:])),[]))

perhaps?

>>> s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>>> "".join(sum(map(list,zip(s,s[len(s)/2:])),[]))
'ANBOCPDQERFSGTHUIVJWKXLYMZ'
>>>

-- Paul 


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

Reply via email to