Incrementing letters

Simon Brunning simon.brunning at gmail.com
Fri May 27 10:53:11 EDT 2005


On 5/27/05, Michael <slick_mick_00 at hotmail.com> wrote:
> Hi,
> I've got a string s, and i want to shift all the letters up by one, eg a->b,
> b->c ........ z->a
> In c++ i can do this quite simply with
> 
> if(C == 'z') C='a';
> else C++;
> 
> but i can't work out how to do this this in python??

Here's one that works on multiple character strings, with carrying.
Rather silly, really.

<http://www.brunningonline.net/simon/blog/archives/001787.html>

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list