Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

URL Parsing Utility?



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.




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org