★ wanayoo — archive 1999 http://www.devshed.com/Server_Side/Python/CGI/comments.html/c1222Nouvelle recherche | Portail wanayoo

Developer Shed
Tuesday, 06.20.2000  
And now for something completely different... Python has a very extensive, well documented and portable module library that provides a large variety of useful functions. The Internet-related collection is particularly impressive, with modules to deal with everything from parsing and retrieving URL's to retrieving mail from POP servers and everything in between.

HOME > SERVER SIDE > PYTHON > ARTICLE > COMMENTS    PHP SOURCE

Power Search
Free Newsletter:


Client Side
DHTML
Flash
Graphics
JavaScript
XML

Server Side
Administration
JServ
MySQL
Perl
PHP
Python
Roxen
Zend
Zope

Tools
HTML Editors
Graphic Editors
FTP Programs

Dev Talk
Forums
Mailing List
Brain Dump
Developer News
Feedback

ClipScripts
Add script
Edit script

Other Stuff
DevShed RDF
Propaganda!


Advertise
on DevShed
.
Writing CGI Programs in Python
And now for something completely different... Python has a very extensive, well documented and portable module library that provides a large variety of useful functions. The Internet-related collection is particularly impressive, with modules to deal with everything from parsing and retrieving URL's to retrieving mail from POP servers and everything in between.

Name: slacker
Subject: Better Way
Date: 09-01-1999 01:49PM

In one of the examples on Page 6 "Putting it all together," the author uses a series of try:/except: as a DevShed reader noted this can be accomplished easier with the following syntax:

if form.has_key('email'):
     email = form['email'].value
else:
     email = ''

Or even this:

email = ''
name = ''
mapping = {
'email':email,
'name':name}

for m in mapping.keys():
     if form.has_key(m):
          mapping[m] = form[m].value

Although either one of these options would probably be a better alternative to the syntax used in the article's example, the example does give a correct example on how to use try:/except: properly.



Other posts in this thread:
 Top
 • Better Way  slacker  09-01-1999 01:49PM 
       • Re: Better Way  Preston Landers  09-05-1999 12:38PM 
       • So Where's The REAL advantage?  Ole Voss  10-26-1999 12:41AM 
             • Re: So Where's The REAL advantage?  Victor Ng  11-17-1999 10:33PM 
             • Re: So Where's The REAL advantage?  Bill Anderson  11-27-1999 07:14AM 
                   • Re: So Where's The REAL advantage?  John Draper  05-04-2000 04:00PM 
                         • Re: So Where's The REAL advantage?  Bill Anderson  05-04-2000 10:38PM 
             • Re: So Where's The REAL advantage?  John Ferguson  01-06-2000 09:27PM 


Reply to this post:
Name:

Preview Comment.
Notify me of replies to this message.
Email:
Subject:
Tip: Put any source code between [code][/code] tags to increase readability


Visit the Python Forum!

New On DevShed:
• Perl 101 (Part 3) - Looping The Loop
• Underwhelmed by WAP - Impressions from the coalface
• WAP-Enabling a Website with PHP3
• Building an E-Commerce Site Part 3: Catalogs and Shopping Carts
• The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP
• Perl 101 (Part 2) - Of Variables And Operators
• The Shell Game
•  Submit Your News..

Hot Forum Topics:
• Problem Writing to file.
• Dynamic Dependent Drop Down Boxes
• htaccess variables
• helpd with JOIN, DELETE, etc...
• Counting across a row...
• How to read data from last to first when use resultset


Adsmart Network ad
Copyright © 1997-2000 ngenuity. All rights reserved. Privacy Policy.