newbie needs help on dictionary

Matthew Miller matthewm at es.co.nz
Thu Dec 9 19:21:28 EST 1999


hi all,

i've created a list of 20 dictionaries thus...

turret = [{}] * 20

then scans text-files for tooling information and add entries to a
certain dictionary in list via

turret[station][tool_name] = 1

my question is how do you increment the value accessed by the key. all
i've been able to figure is

count = turret[station][tool_name]
count = count + 1
turret[station][tool_name] = count

pretty inelegant really - hopefully there is abetter way.

thanking you all. matthew.




More information about the Python-list mailing list