; my_keys.sort()
>> print "my_keys_asc_sort =%s" %my_keys
>>
>> my_keys.sort(sort_fun)
>> print "my_keys_desc_sort =%s" %my_keys
>>
>>
>>
>>
>> "Ondrej Beran"
>> Sent by: python-boun...@py.cz
>> 10.10.
viz dole
> Ondrej Beran
> 2007/10/10, rajcze <[EMAIL PROTECTED]>:
> > Myslim ze Ondrej hleda spis neco takovehoto
> >
> > slovnik = {1:'z', 2:'a', 3:'c'}
> > index_slovniku = slovnik.items()
> > index_slovniku.sort(lambda x,y: cmp(x[1],y[1]))
> > index_slovniku = map(lambda x: x[0], index_slovniku
2007/10/10, rajcze <[EMAIL PROTECTED]>:
> Myslim ze Ondrej hleda spis neco takovehoto
JJ, to je presne to, co jsem nedokazal vymyslet.
Porad jsem nevedel jak docilit, aby se mi se tridenou hodnotou
movenul/swapnul i klic
> urcite se to da napsat hezceji :)
Hlavne, kdyz to dela to, co potrebuj
>> my_keys=my_dict.keys()
>>
>> my_keys.sort()
>> print "my_keys_asc_sort =%s" %my_keys
>>
>> my_keys.sort(sort_fun)
>> print "my_keys_desc_sort =%s" %my_keys
>>
>>
>>
>>
>> "Ondrej Beran" <[EMAIL PROTECTED]>
ict
>
> my_keys=my_dict.keys()
>
> my_keys.sort()
> print "my_keys_asc_sort =%s" %my_keys
>
> my_keys.sort(sort_fun)
> print "my_keys_desc_sort =%s" %my_keys
>
>
>
>
> "Ondrej Beran" <[EMAIL PROTECTED]>
> Sent by: [EMAIL PRO
%s" %my_keys
for key in my_keys:
print "%s:%s" % (key, my_dict[key])
[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
10.10.2007 11:33
Please respond to
Konference PyCZ
To
Konference PyCZ
cc
Subject
Re: [python] Jak setridit dictionary
Ak chces triedit kluce podla neja
; %my_keys
my_keys.sort(sort_fun)
print "my_keys_desc_sort =%s" %my_keys
"Ondrej Beran" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
10.10.2007 11:01
Please respond to
Konference PyCZ
To
python@py.cz
cc
Subject
[python] Jak setridit dictionary
Ahoj vsichni,
ma
Ahoj vsichni,
mam dictionary napr. {1:'z', 2:'m', 3:'a', } a potreboval bych k
nemu vytvorit neco jako index setrideny podle hodnoty, napr.
[3,2,1,...], abych mohl s polozkami v dicitionary pracovat v poradi
danem tim indexem.
Ale nenapada mi, jak to udelat... Poradi mi nekdo?
Diky, Ondrej
_