<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p class="MsoNormal">Hello, </p>
<p class="MsoNormal"><span style="mso-spacerun:yes"></span>I am
still fairly new to python, but find it to be a great scripting
language.<span style="mso-spacerun:yes"> </span>Here is my
issue:</p>
<p class="MsoNormal">I am attempting to utilize a function to
receive any sequence of letter characters and return to me the
next value in alphabetic order e.g. send in “abc” get back “abd”.<span
style="mso-spacerun:yes"> </span>I found a function on
StackExchange (Rosenfield, A 1995) that seems to work well enough
(I think):</p>
<p class="MsoNoSpacing"><i>def next(s):</i></p>
<p class="MsoNoSpacing"><i><span style="mso-spacerun:yes"> </span>strip_zs
= s.rstrip('z')</i></p>
<p class="MsoNoSpacing"><i><span style="mso-spacerun:yes"> </span>if
strip_zs:</i></p>
<p class="MsoNoSpacing"><i><span style="mso-spacerun:yes"> </span>return
strip_zs[:-1]
+ chr(ord(strip_zs[-1]) + 1) + 'a' * (len(s) - len(strip_zs))</i></p>
<p class="MsoNoSpacing"><i><span style="mso-spacerun:yes"> </span>else:</i></p>
<p class="MsoNoSpacing"><i><span style="mso-spacerun:yes"> </span>return
'a' * (len(s) + 1)</i></p>
<p class="MsoNoSpacing"><o:p> </o:p>I have found this function works
well if I call it directly with a string enclosed in quotes:</p>
<p class="MsoNoSpacing"><o:p> </o:p>returnValue = next(“abc”)</p>
<p class="MsoNoSpacing"><o:p> </o:p>However, if I call the function
with a variable populated from a value I obtain from an array[] it
fails returning only ^K<span style="mso-spacerun:yes"> </span></p>
<p class="MsoNoSpacing"><o:p> </o:p>Unfortunately, because I don’t
fully understand this next function I can’t really interpret the
error.<span style="mso-spacerun:yes"> </span>Any help would be
greatly appreciated.<span style="mso-spacerun:yes"> </span></p>
<p class="MsoNoSpacing"><o:p> </o:p>Thanks ahead of time, </p>
<p class="MsoNoSpacing">Derek </p>
</body>
</html>