[Tutor] ideas?
Peter Otten
__peter__ at web.de
Mon Nov 18 12:00:27 CET 2013
Byron Ruffin wrote:
> Need a little help with finding a process for this:
>
> when a string of text is input, for example: abc def.
> I want to have each letter shift to the right one place in the alphabet.
> Thus..
> abc def would be output as bcd efg.
>
> Any ideas on how to do this?
Have a look at the str.maketrans() and str.translate() methods:
>>> trans = str.maketrans("abc", "xyz")
>>> "abba cdef".translate(trans)
'xyyx zdef'
More information about the Tutor
mailing list