print_directory(formats the name of the current working directory in html and prints it out the resulting output will be sent back to the browserwhich can be useful for debugging print_environ(creates list of all environment variables formatted in html and is used for debugging print_environ_usage(prints more selected list of useful environment variables in html and is used for debugging print_form(formformats the data supplied on form in html form must be an instance of fieldstorage used for debugging test(writes minimal http header and prints all the information provided to the script in html format primarily used for debugging to make sure your cgi environment is set up correctly cgi programming advice in the current age of web frameworkscgi scripting seems to have fallen out of fashion howeverif you are going to use itthere are couple of programming tips that can simplify your life firstdon' write cgi scripts where you are using huge number of print statements to produce hard-coded html output the resulting program will be horrible tangled mess of python and html that is not only impossible to readbut also impossible to maintain better approach is to rely on templates minimallythe string template object can be used for this here is an example that outlines the conceptimport cgi from string import template def error(message)temp template(open("errormsg html"read()print 'content-typetext/html\rprint '\rprint temp substitute({'messagemessage}form cgi fieldstorage(name form getfirst('name'email form getfirst('email'if not nameerror("name not specified"raise systemexit elif not emailerror("email not specified"raise systemexit do various processing confirmation subscribe(nameemailf lib fl ff