Revision: 2579
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 12, 2007 11:05 by abhiomkar
Initial Code
# Snippler - getCode() # snipplr # Author : Abhinay Omkar import re,urllib2,sys # input url = "http://snipplr.com/view/8/ajax-edit-in-place/" try: inurl = sys.argv[1] except: print "Err: url is missing." sys.exit() try: path = sys.argv[2] except: path = inurl.split('/')[-2] num = re.sub(r'[a-zA-Z/:\-.]*','',inurl) url = "http://snipplr.com/view.php?codeview&id="+num raw = repr(urllib2.urlopen(url).read()) prog = re.compile(r'<textarea rows="25">(.*)</textarea>').search(raw).group() open prog = prog.replace('\\r\\n','\n').replace('\\t',' ')[20:-11] print "File "+path+" Opened..." print prog open(path,'w').write(prog)
Initial URL
Initial Description
Initial Title
snipplr :: getCode()
Initial Tags
python
Initial Language
Python