Public feed #380490

Someone

public text v1 · immutable
Raw Edit
·published 2007-03-04 03:10 UTC
rendered paste body
import sys
import urllib
import getopt
import re


try:                                
   opts, args = getopt.getopt( sys.argv[1:], "f:u:ap", ["help", "grammar="] ) 
except getopt.GetoptError:           
   usage()                          
   sys.exit( 2 )    

f = 'nofilename.txt'
     
for opt, arg in opts:       
                                 
   if opt == '-f':                
      f = open( arg, r )
            
   elif opt == "-u":
      f = urllib.urlopen( arg )
            
   elif opt == '-a': 
      order = 'alphabetical'
            
   elif opt == '-p':
      order = 'pricewise'


f = f.read()

#print f

pattern = 'href="http:' #//www.amazon.com/gp/product/'

mo = True
while(mo):
    mo = re.search(pattern, f)
    print mo
    #print mo.group(1)