CGI question
Fredrik Lundh
fredrik at pythonware.com
Wed Nov 30 08:06:39 EST 2005
Dan Stromberg wrote:
> >> What's the best way of converting this:
> >>
> >> 'hide\\?http://www.dedasys.com/articles/programming_language_economics.html\x012005-07-20
> >> 14:48'
> >>
> >> ...to something easily usable in a python CGI script?
> >
> > easily usable for what purpose?
> >
> > if you want to extract the URL that seems to be hidden in that string,
> > something like:
> >
> > url, junk = text.split("\x01", 1)
> > junk, url = url.split("\\?", 1)
> >
> > should work.
> >
> > </F>
>
> This is great, but is there no standard python module for taking
> apart command line arguments to a CGI script? I'm not eager to reinvent
> the wheel, at least not on this project :)
command-line arguments to CGI scripts?
I'm probably dense, but doesn't CGI scripts usually get their arguments via
environment variables and stdin ? and chr(1) and "hide\?" sure don't look
like standard URL separators to me...
if you want standard CGI argument handling, the "cgi" module contains all
the tools you need.
</F>
More information about the Python-list
mailing list