URL Parsing Utility?
Kent Borg
kentborg at borg.org
Mon Apr 8 17:22:14 EDT 2002
On Mon, Apr 08, 2002 at 03:57:31PM -0500, will wrote:
>
> This is a 5-line python script:
>
> import sys, urllib
> try:
> print urllib.unquote(sys.stdin.readline())
> except:
> print "could not be unquoted."
>
>
> On Mon, 8 Apr 2002, Kent Borg wrote:
>
> > Anyone know of a simple but good little URL parser?
Cool, thanks!
Greedy, I have another question:
Is there a magic thingie I can put at the top of the script so that
bash will automatically send it off to python?
That is, I invoked it as:
$ echo '%36%36%2E%333.%36%30%2E9%31%2Fme%65tp%65o%70%6C%65' | python unquote
But would like to do the simpler:
$ echo '%36%36%2E%333.%36%30%2E9%31%2Fme%65tp%65o%70%6C%65' | unquote
Hell, if your fingers are just ~itching~ to add a couple more lines, I
wouldn't mind being able to say (in addition to still having stdin
available, of course):
$ unquote '%36%36%2E%333.%36%30%2E9%31%2Fme%65tp%65o%70%6C%65'
Thanks,
-kb, the Kent who, after long thinking he should, is finally learning
a bit of python.
More information about the Discuss
mailing list