[mod_python] python print

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Mon Jun 9 12:25:02 EST 2003

Dear Mr. Russell, thank you I forgot about '+=', which did the trick.
The KeyError is generated when mod python encounters the space when I
submit multiple sequences of numbers, which is why I had the 'for
argument in numbers' which in command line mode delimits arguments but as
a POST seems to break the code.  I could always put a value in dict1

 ' ' : '/n',
 ',' : '/n'

On 9 Jun 2003, Scott Russell wrote:

> On Mon, 2003-06-09 at 14:39, tpc at csua.berkeley.edu wrote:
> >Hello, I have a script meant to be run from the command line that
> > for each command line argument, iterates through the characters,
> > returns the value from a dictionary, and prints out the joined
> > string with no spaces:
> <snip>
> I'm new on the list, but this looks like a python issue, not a
> mod_python issue.  Your middle example should work fine, when you stop
> returning in the middle of it:
> def convert(numbers):
>    w = ""
>    for argument in numbers:
>        W += ''.join([dict1[character] for character in argument])
>    return w
> Do I not understand the problem?  Note, I wrote this with the assumption
> that you were passing a sequence (list, tuple, dict) of character
> strings, as your second and third examples seem to.  Your original
> "print" code did not make this assumption.
> BTW, I would expect you to get keyerrors if you're not validating inputs
> - this code doesn't check for exceptions at all.
> - Scott

More information about the Mod_python mailing list