incrementing characters
Lee Harr
missive at frontiernet.net
Mon Jul 23 19:00:25 EDT 2001
On Mon, 23 Jul 2001 18:22:02 GMT, Nick Perkins <nperkins7 at home.com> wrote:
>
> "Holland King" <insanc at cc.gatech.edu> wrote in message
> news:9jhojp$t7h$1 at solaria.cc.gatech.edu...
>> how do you interate a letter or string? for instance:
>> a + 1 = b
>> or
>> aa + 1 = ab
>> etc. in c it is similar to above and i am guessing there is an equally
>> simple way to do it in python, i just can't figure it out. thank you
>> for your time and help.
perl makes this simple:
$s = "aabc";
$s++;
print "$s\n";
$s = "zzzz";
$s++;
print "$s\n";
would print:
aabd
aaaaa
I think in python I would create some kind of IncrementableString class
which does exactly what I want it to do on only the right kind of data.
More information about the Python-list
mailing list