Untitled

From Funky Lemur, 10 Years ago, written in Plain Text, viewed 2 times.
URL https://paste.blessuren.de/view/fc747d90 Embed
Download Paste or View Raw
  1. def search(titel, ls):
  2.    for dic in ls:
  3.       if titel in dic:
  4.          return True
  5.    return False
  6.  
  7. w={"http://www.googel.de":"google","http://www.heise.de":"heise","http://www.googel.de":"google"}
  8.  
  9. # key is uniq
  10. for key in w:
  11.    print "Titel: %s Key: %s" % (w[key],key)
  12.  
  13. b = {}
  14. c={"http://www.google.de":"INHALT DER SEITE"}
  15. b.update({"Reisepass":c})
  16.  
  17. c={"http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=418":"INHALT VON FAHRZEUG"}
  18. b.update({"Fahrzeugzulassung":c})
  19.  
  20. for key in b:
  21.    print "Eindeutiger Titel: %s Key: %s" % (key, b[key])
  22.    print b[key]
  23.  
  24. # Haben wir den Reisepass schon erfasst?
  25. print 'Reisepass' in b
  26.  
  27. #for link, content in b.iteritems():
  28. #   print "Link: %s Content: %s" % (link,content)
  29.  
  30. ls = [{
  31.     'Reisepass': {
  32.         'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=152',
  33.         'content': 'INHALT REISEPASS'
  34.     },
  35.     'Fahrzeugzulassung': {
  36.         'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=418',
  37.         'content': 'INHALT FAHRZEUG'
  38.     },
  39. }]
  40.  
  41. i = 0
  42. for dic in ls:
  43.     for key in dic:
  44.         print 'Titel: %s' % (key)
  45.         print 'Link: %s' % dic[key]['link']
  46.         print 'Content: %s' % dic[key]['content']
  47.  
  48. new={'Lohnsteuerkarte': {'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=159','content': 'INHALT LONHSTEUER'}}
  49. new2={'Lohnsteuerkarte': {'link': 'http://buerger.osnabrueck.de/public/index.php?l=172&mr=20&p=159','content': 'INHALT LONHSTEUER'}}
  50.  
  51. #print type(ls)
  52. #print type(new2)
  53. ls.append(new)
  54. print new in ls
  55. print new2 in ls
  56.  
  57. print "Die Suche nach Reisepass hat ergeben: " + str(search('Reisepass',ls))
  58. print "Die Suche nach Haus hat ergeben: " + str(search('Haus',ls))
  59.  

Reply to "Untitled"

Here you can reply to the paste above