On Fri, 27 May 2005 16:10:32 +0200, Wolfram Kraus <[EMAIL PROTECTED]> wrote:
> Duncan Booth wrote: >>>>> import string >>>>> upone = string.maketrans( >> 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', >> 'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA') >> >>>>> string.translate("I've got a string s....", upone) >> "J'wf hpu b tusjoh t...." >> Note the difference though: the Python code does what you said you >> wanted, whereas your sample code corrupts punctuation. > Wow, that's quite nice. You really learn something new every day :-) A > minor improvement: Use string.ascii_letters as the first parameter for > string.maketrans And use string.ascii_letters[ 1 : ] + string.ascii_letters[ 0 ] for the second parameter to string.maketrans. Regards, Dan -- Dan Sommers <http://www.tombstonezero.net/dan/> -- http://mail.python.org/mailman/listinfo/python-list