Python CGI: how to retrieve variables passed by URL

Sean Berry sean_berry at
Fri Apr 23 07:42:44 CEST 2004

This may help, but not sure if there is a better, built in way.

print os.environ["QUERY_STRING"].split("=")[1]

prints value if I use localhost/cgi-bin/script-name.cgi?variable=value and
this will work... but is there a better way?

"Sean Berry" <sean_berry at> wrote in message
news:hU1ic.86730$U83.37750 at fed1read03...
> If I go to my cgi python script with
> localhost/cgi-bin/script-name.cgi?variable=value
> How do I gather this value?
> Thanks in advance.

More information about the Python-list mailing list