Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47562

Re: Reply to post 'Tryign to add a valkue to a set'

X-Received by 10.224.36.66 with SMTP id s2mr8552026qad.6.1370873020109; Mon, 10 Jun 2013 07:03:40 -0700 (PDT)
X-Received by 10.49.29.99 with SMTP id j3mr374848qeh.23.1370873020084; Mon, 10 Jun 2013 07:03:40 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!p1no3949857qaj.0!news-out.google.com!y6ni1618qax.0!nntp.google.com!ch1no3410716qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 10 Jun 2013 07:03:39 -0700 (PDT)
In-Reply-To <p20h8a-q0c.ln1@satorlaser.homedns.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=79.103.41.173; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4
NNTP-Posting-Host 79.103.41.173
References <201306100650.873248273868@forums.devshed.com> <mailman.2963.1370861835.3114.python-list@python.org> <p20h8a-q0c.ln1@satorlaser.homedns.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <318cb046-cba2-41fa-9bd5-934a8ab0afa4@googlegroups.com> (permalink)
Subject Re: Reply to post 'Tryign to add a valkue to a set'
From Νικόλαος Κούρας <nikos.gr33k@gmail.com>
Injection-Date Mon, 10 Jun 2013 14:03:40 +0000
Content-Type text/plain; charset=ISO-8859-7
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:47562

Show key headers only | View raw


Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε:
> Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας:
> 
> >  >Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich
> 
> > Eckhardt έγραψε:
> 
> >
> 
> > for key in sorted( months.keys() ):
> 
> >          print('''
> 
> >                  <option value="%s"> %s </option>
> 
> >          ''' % (months[key], key) )
> 
> >
> 
> > this in fact works, it sorts the dict by its keys()
> 
> 
> 
> No, it does not sort the dict. Please slow down, relax and take a look 
> 
> at the documentation of sorted(). You are jumping to conclusions based 
> 
> on flawed expectations and assumptions, which can only yield garbage in 
> 
> the end.
> 
> 
> 
> Uli

It soerts it just fine by keys() alpabeticall but this isnt what i want, i need sorting by values()

for key in sorted( months.values() ): 
         print(''' 
                 <option value="%s"> %s </option> 
         ''' % (key, what should_we put here_to get the actual months 
name? ) 

the value is a vale form  the values in order, but how do i specify the correspondign key to that value?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Reply to post 'Tryign to add a valkue to a set' Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 13:57 +0300
  Re: Reply to post 'Tryign to add a valkue to a set' Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-06-10 15:14 +0200
    Re: Reply to post 'Tryign to add a valkue to a set' Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 06:37 -0700
      Re: Reply to post 'Tryign to add a valkue to a set' Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-06-10 16:58 +0200
    Re: Reply to post 'Tryign to add a valkue to a set' Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 07:03 -0700
      Re: Reply to post 'Tryign to add a valkue to a set' Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 07:37 -0700
  Re: Reply to post 'Tryign to add a valkue to a set' russ.pobox@gmail.com - 2013-06-10 08:34 -0700
    Re: Reply to post 'Tryign to add a valkue to a set' Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 08:55 -0700
  Re: Reply to post 'Tryign to add a valkue to a set' russ.pobox@gmail.com - 2013-06-11 00:21 -0700

csiph-web