Advertisement
Lazza

Ricerca stampanti Brother wireless

Jan 14th, 2014
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. import urllib2, re
  2.  
  3. lista = """compatibile con Brother DCP-145C, DCP-163C, DCP-165C, DCP-167C, DCP-185C, DCP-195C, DCP-197C, DCP-365CN, DCP-373CW, DCP-375CW, DCP-377CW, DCP-383C, DCP-385C, DCP-387C, DCP-395CN, DCP-585CW, DCP-6690CW, DCP-J125, DCP-J140W, DCP-J315W, DCP-J515W, DCP-J715W, MFC-250C, MFC-255CW, MFC-257CW, MFC-290C, MFC-295CN, MFC-297C, MFC-490CW, MFC-5490CN, MFC-5890CN, MFC-5895CW, MFC-6490CW, MFC-6890CDW, MFC-790CW, MFC-795CW, MFC-990CW, MFC-J220, MFC-J265W, MFC-J410, MFC-J415W, MFC-J615W, MFC-J615W. Cartucce Compatible. LC-1100BK , LC-1100C , LC-1100M , LC-1100Y , LC-980BK , LC-980C , LC-980M , LC-980Y , LC-985BK , LC-985C , LC-985M , LC-985Y"""
  4.  
  5. modelli = lista.replace(',', ' ').replace('.', ' ').split(' ')
  6. modelli = set([m for m in modelli if '-' in m])
  7.  
  8. # Scopiazzato da:
  9. # http://stackoverflow.com/questions/6035510/
  10. def results(word):
  11.     text = urllib2.urlopen('http://www.bing.com/search?q=%s'%word).read()
  12.     m = re.search('([0-9,]+) r[ei]sult', text)
  13.     if m is None:
  14.         return None
  15.     else:
  16.         return int(m.group(1).replace(',', ''))
  17.  
  18. for m in modelli:
  19.     print m + ' ' + str(results('"' + m + '+wireless"'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement