Wenn ich ein Dictionary erstelle und auslese, bekomme ich folgendes Ergebnis
Code: Alles auswählen
d={"kuh":"muh"}
print d.get('kuh','not found')
#Ausgabe
muh

Code: Alles auswählen
theIndex = {}
def addToDict(word, pagenumber):
if theIndex.has_key(word):
theIndex[word].append(pagenumber)
else:
theIndex[word] = [pagenumber]
print theIndex.get('kuh', 'not found')
addToDict("kuh","muh")
#Ausgabe
['muh']