Re: Incrementing letters

2005-05-31 Thread Dan Sommers
On 27 May 2005 10:52:36 -0400, Dan Sommers [EMAIL PROTECTED] wrote: And use string.ascii_letters[ 1 : ] + string.ascii_letters[ 0 ] for the second parameter to string.maketrans. Oops. Thank you Duncan and Rocco for correcting my mistake. Regards, Dan -- Dan Sommers

Re: Incrementing letters

2005-05-27 Thread Heiko Wundram
Am Freitag, 27. Mai 2005 13:31 schrieb Michael: if(C == 'z') C='a'; else C++; if C == z: C = a else: C = chr(ord(C)+1) -- --- Heiko. see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/ pgpC3uVPL36vD.pgp Description: PGP signature --

Re: Incrementing letters

2005-05-27 Thread Wolfram Kraus
Heiko Wundram wrote: Am Freitag, 27. Mai 2005 13:31 schrieb Michael: if(C == 'z') C='a'; else C++; if C == z: C = a else: C = chr(ord(C)+1) According to the OP's problem (with the assumption that only characters from a-z are given) he might even try a lil LC: s = shiftthis

Re: Incrementing letters

2005-05-27 Thread Duncan Booth
Michael 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?? import string upone = string.maketrans(

Re: Incrementing letters

2005-05-27 Thread Wolfram Kraus
Duncan Booth wrote: Michael 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?? import string upone =

Re: Incrementing letters

2005-05-27 Thread Simon Brunning
On 5/27/05, Michael [EMAIL PROTECTED] 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

Re: Incrementing letters

2005-05-27 Thread Dan Sommers
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,

Re: Incrementing letters

2005-05-27 Thread Duncan Booth
Dan Sommers wrote: Wolfram Kraus [EMAIL PROTECTED] wrote: Duncan Booth wrote: import string upone = string.maketrans( 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA') string.translate(I've got a string s, upone)

Re: Incrementing letters

2005-05-27 Thread Rocco Moretti
Dan Sommers wrote: On Fri, 27 May 2005 16:10:32 +0200, Wolfram Kraus [EMAIL PROTECTED] wrote: Duncan Booth wrote: import string upone = string.maketrans( 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA')