| Reply | « Previous Thread | Next Thread » |
|
Hi
I've noticed a strange behavior in the dictionary objects - when I add three different keys, let's just say: Code:
q={}
q[u'Image1']=u'path1'
q[u'XMLfile1']=u'path2'
q[u'Image2']=u'path3'
Code:
q.keys() [u'Image2', u'Image1', u'XMLfile1'] Does anyone know whether it possible to get the keys in the order it was added? |
| madsbjoern |
| View Public Profile |
| Find all posts by madsbjoern |
|
Quote:
From http://www.python.org/doc/2.2.2/lib/typesmapping.html: Quote:
|
|
Quote:
But it exists implementation of ordered dictionary I already put one link on it in the wiki Look at odict ! Cyke64 pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 ! pys60 extension modules on http://cyke64.googlepages.com/ |
|
Quote:
![]() /Mads |
| madsbjoern |
| View Public Profile |
| Find all posts by madsbjoern |
|
Quote:
![]() |
| madsbjoern |
| View Public Profile |
| Find all posts by madsbjoern |
|
Code:
>>>q={}
>>>q[u'Image1']=u'path1'
>>>q[u'XMLfile1']=u'path2'
>>>q[u'Image2']=u'path3'
>>>l=q.keys()
>>>l.sort()
>>>l
[u'Image1', u'Image2', u'XMLfile1']
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |