Python Ausgabe
Verfasst: Donnerstag 1. Dezember 2005, 22:35
Hallo,
wieso gibt mir Python bei diesem Programm:
bei:
<print dic[dic["3"]/2][-1*dic["b"]/5]>
nichts aus und bei
<print "o"+dic[1]>
KeyError: 1 aus???
Könnt ihr mir helfen? Danke
Edit (Leonidas): Code in Python-Tags gesetzt.
wieso gibt mir Python bei diesem Programm:
Code: Alles auswählen
D="A dictionary is a mutable unordered collection of key/item pairs"
DS="Lists, sets,tuples,dictionaries,queues and stacks are data structures"
dic={"1":"k","b":5,2:dict([tuple((-1,""))]),"3":4}
print dic[dic["3"]/2][-1*dic["b"]/5]
print "o"+dic[1]
bei:
<print dic[dic["3"]/2][-1*dic["b"]/5]>
nichts aus und bei
<print "o"+dic[1]>
KeyError: 1 aus???
Könnt ihr mir helfen? Danke
Edit (Leonidas): Code in Python-Tags gesetzt.