uses a dictionary as the sequence to display the dictionary contents : enumerate « Buildin Function « Python Tutorial






dict = {}
string="1234"
for i,ch in enumerate(string):
    dict[i] = ch
print dict


for key in dict:
    print key, '=', dict[key]








13.14.enumerate
13.14.1.uses the enumerate(string) to create a temporary sequence
13.14.2.uses a dictionary as the sequence to display the dictionary contents