a question about map object

Frank Zheng hust_zxq524 at 263.net
Mon Mar 17 08:07:52 CET 2003


Hi, all

i have a map object:

DataMap = {'Index':       (14,1,ord),
               'name':        (16,22,stripnulls),
               'group':       (39,1,ord),
               'email1':      (41,48,stripnulls),
               'email2':      (90,48,stripnulls),
               'email3':      (139,48,stripnulls),
               'URL:'  :      (187,48,stripnulls),
               'ringtone':    (237,1,ord),
               'msgtone':     (238,1,ord),
               'memo':        (240,32,stripnulls),
               'phonetypes' : (274,5,stripnulls),
               'phone1:':     (279,48,stripnulls),
               'phone2:':     (328,48,stripnulls),
               'phone3:':     (377,48,stripnulls),
               'phone4:':     (426,48,stripnulls),
               'phone5:':     (475,48,stripnulls)
               }
then,i want to list all the keys:

>>> for k, v in DataMap.items():
...     print k
...
Index
group
name
phone5:
msgtone
memo
phone4:
phonetypes
ringtone
phone3:
phone2:
phone1:
email1
email2
email3
URL:
>>>

u will find the orders of keys have been changed

i think the map is a ordered-sequences, but what should i do can keep its
order be same with
input order


thanks


Frank






More information about the Python-list mailing list