- def search(titel, ls):
- for dic in ls:
- if titel in dic:
- return True
- return False
- w={"http://www.googel.de":"google","http://www.heise.de":"heise","http://www.googel.de":"google"}
- # key is uniq
- for key in w:
- print "Titel: %s Key: %s" % (w[key],key)
- b = {}
- c={"http://www.google.de":"INHALT DER SEITE"}
- b.update({"Reisepass":c})
- c={"http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=418":"INHALT VON FAHRZEUG"}
- b.update({"Fahrzeugzulassung":c})
- for key in b:
- print "Eindeutiger Titel: %s Key: %s" % (key, b[key])
- print b[key]
- # Haben wir den Reisepass schon erfasst?
- print 'Reisepass' in b
- #for link, content in b.iteritems():
- # print "Link: %s Content: %s" % (link,content)
- ls = [{
- 'Reisepass': {
- 'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=152',
- 'content': 'INHALT REISEPASS'
- },
- 'Fahrzeugzulassung': {
- 'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=418',
- 'content': 'INHALT FAHRZEUG'
- },
- }]
- i = 0
- for dic in ls:
- for key in dic:
- print 'Titel: %s' % (key)
- print 'Link: %s' % dic[key]['link']
- print 'Content: %s' % dic[key]['content']
- new={'Lohnsteuerkarte': {'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=159','content': 'INHALT LONHSTEUER'}}
- new2={'Lohnsteuerkarte': {'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=159','content': 'INHALT LONHSTEUER'}}
- #print type(ls)
- #print type(new2)
- ls.append(new)
- print new in ls
- print new2 in ls
- print "Die Suche nach Reisepass hat ergeben: " + str(search('Reisepass',ls))
- print "Die Suche nach Haus hat ergeben: " + str(search('Haus',ls))