[Tutor] Re: Translating to Python [perl --> python]
Blake Winton
bwinton@latte.ca
Mon, 1 Jul 2002 19:30:25 -0400
* Derrick 'dman' Hudson <dman@dman.ddts.net> [020701 18:39]:
> try :
> # Bug #2: s/cgi/form/ Danny meant to index the form object, not
> # the cgi module.
> c = form['c'].value
> except KeyError :
> # What to do if the parameter doesn't exist. I suppose
> # considering it to be the empty string is what is desired in this
> # case.
> c = ""
> content = 'c'
I think that might be more useful if it was
content = c
That way, if the content isn't there, you get whatever
the user typed in, instead of the letter 'c'. ;)
> if c == 'abc':
> content = "abc123"
> elif c == 'def':
> content = "def456"
> else:
> print "error: content failed\n"
Later,
Blake.
--
7:30pm up 1 day, 23:52, 4 users, load average: 0.00, 0.00, 0.00