print the output page values 'namename'emailemail'confirmation'confirmationadd other values here temp template(open("success html"read(print temp substitute(valuesin this examplethe files 'error htmland 'success htmlare html pages that have all of the output but include $variable substitutions corresponding to dynamically generated values used in the cgi script for examplethe 'success htmlfile might look like thissuccess welcome $name you have successfully subscribed to our newsletter your confirmation code is $confirmation the temp substitute(operation in the script is simply filling in the variables in this file an obvious benefit of this approach is that if you want to change the appearance of the outputyou just modify the template filesnot the cgi script there are many thirdparty template engines available for python--maybe in even greater numbers than web frameworks these take the templating concept and build upon it in substantial ways see secondif you need to save data from cgi scripttry to use database although it is easy enough to write data directly to fileswebservers operate concurrentlyand unless you've taken steps to properly lock and synchronize resourcesit is possible that files will get corrupted database servers and their associated python interface usually don' have this problem so if you need to save datatry to use module such as sqlite or third-party module for something like mysql finallyif you find yourself writing dozens of cgi scripts and code that has to deal with low-level details of http such as cookiesauthenticationencodingand so forthyou may want to consider web framework instead the whole point of using framework is so that you don' have to worry about those details--wellat least not as much sodon' reinvent the wheel notes the process of installing cgi program varies widely according to the type of webserver being used typically programs are placed in special cgi-bin directory server may also require additional configuration you should consult the documentation for the server or the server' administrator for more details lib fl ff