# HG changeset patch # User Jeff Hammel # Date 1372978898 25200 # Node ID 5e0b4ec360137c6019afc94ef6c550acae6d2a12 # Parent d0da972238d0ac5b1051f326bf6b91543fd89afc add another textshaper thingy diff -r d0da972238d0 -r 5e0b4ec36013 python/url2txt.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/url2txt.py Thu Jul 04 16:01:38 2013 -0700 @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# xclip -o | sed 's/_//' | sed 's/.html//' + +def url2txt(url): + """gets the text equivalent of a URL""" + url = url.rstrip('/') + if '/' in url: + url = url.rsplit('/')[-1] + if '.' in url: + url = url.split('.', 1)[0] + url = url.replace('_', ' ') + return url + +if __name__ == '__main__': + import sys + print url2txt(' '.join(sys.argv[1:]))