Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #47536
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fabiosantosart@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'charset:iso-8859-7': 0.04; 'output': 0.05; 'key.': 0.09; 'subject:set': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; "'''": 0.16; 'integers.': 0.16; 'key)': 0.16; 'keyerror': 0.16; 'subject:fails': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'meant': 0.20; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'sort': 0.25; '>': 0.26; 'skip:" 40': 0.26; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; "skip:' 10": 0.31; 'keyerror:': 0.31; 'skip:7 10': 0.31; 'file': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'url:mail': 0.40; 'tell': 0.60; 'to:addr:gmail.com': 0.65; '8bit%:57': 0.74; '8bit%:60': 0.84; '8bit%:67': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=U6h6yi1J+UBFOjHoN6v6uvo4glTwz0cVRka5QdxBSIs=; b=u2um/V+1K6VqHCP1zycE+IjoxEYjIfRiihvtYIC3jMhlIPve2dUSvfiAbjeryRx00f 7EByyLrPgxVwxYkDc3EI1GoStZ0wrpFx4FKr+Sqkml8OsotZ6dDS3Q8V+pgCZFigcBv5 XjHh/w5BYS/+osSaUzWXL4BYYLtI3c6yNGw9mYwPH/OJkrx9wx47y/dFlxeCDkqKUQjE Xbb5/Y+9kHxpM9g/pLe0EVX4NQba+HYB6C0hsMwjQ3E0Bsidc6rxL+znPYDAanILDgDE NbCvHi8iplbE54Z0YfqlQGipMgU6D2PCy8PrmqAJZFrvEjvfSEp0zhErSK845IeBkjPD s0cA== |
| MIME-Version | 1.0 |
| X-Received | by 10.229.133.65 with SMTP id e1mr3615424qct.105.1370856434294; Mon, 10 Jun 2013 02:27:14 -0700 (PDT) |
| In-Reply-To | <c2eb322d-ac51-4e6a-aa56-3b6b8267ebc4@googlegroups.com> |
| References | <3b252a10-a7e3-40f5-99dc-8afcf72cf997@googlegroups.com> <ce76b1a2-62d0-481d-b045-4bc791a84e37@googlegroups.com> <a609b6e4-b5a5-4d72-b5e1-c7271efe8a72@googlegroups.com> <c2eb322d-ac51-4e6a-aa56-3b6b8267ebc4@googlegroups.com> |
| Date | Mon, 10 Jun 2013 10:27:14 +0100 |
| Subject | Re: Sorting a set works, sorting a dictionary fails ? |
| From | Fábio Santos <fabiosantosart@gmail.com> |
| To | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
| Content-Type | multipart/alternative; boundary=e89a8f50389ccdec9104dec9622a |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2960.1370856443.3114.python-list@python.org> (permalink) |
| Lines | 89 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1370856443 news.xs4all.nl 15904 [2001:888:2000:d::a6]:47121 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:47536 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 10 Jun 2013 09:34, "Νικόλαος Κούρας" <nikos.gr33k@gmail.com> wrote:
>
> Trying this:
>
> months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4,
'Μάϊος':5, 'Ιούνιος':6, \
> 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10,
'Νοέμβριος':11, 'Δεκέμβριος':12 }
>
> for key in sorted( months.values() ):
> print('''
> <option value="%s"> %s </option>
> ''' % (months[key], key) )
>
>
> output this:
>
> [Mon Jun 10 11:25:11 2013] [error] [client 79.103.41.173] File
"/home/nikos/public_html/cgi-bin/pelatologio.py", line 310, in <module>,
referer: http://superhost.gr/
> [Mon Jun 10 11:25:11 2013] [error] [client 79.103.41.173] ''' %
(months[key], key) ), referer: http://superhost.gr/
> [Mon Jun 10 11:25:11 2013] [error] [client 79.103.41.173] KeyError: 1,
referer: http://superhost.gr/
>
> KeyError 1 ??!! All i did was to tell python to sort the dictionary
values, which are just integers.
> --
> http://mail.python.org/mailman/listinfo/python-list
KeyError: 1 means that there is no int(1) key. I think you meant to do "for
key in sorted(yourdict.keys())"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 01:04 -0700
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 01:16 -0700
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 01:18 -0700
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 01:29 -0700
Re: Sorting a set works, sorting a dictionary fails ? Fábio Santos <fabiosantosart@gmail.com> - 2013-06-10 10:27 +0100
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 02:32 -0700
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 02:48 -0700
Re: Sorting a set works, sorting a dictionary fails ? Fábio Santos <fabiosantosart@gmail.com> - 2013-06-10 11:13 +0100
Re: Sorting a set works, sorting a dictionary fails ? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-06-10 15:11 +0200
Re: Sorting a set works, sorting a dictionary fails ? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-06-10 11:40 +0200
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 03:20 -0700
Re: Sorting a set works, sorting a dictionary fails ? Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-10 03:42 -0700
Re: Sorting a set works, sorting a dictionary fails ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-10 11:47 +0000
Re: Sorting a set works, sorting a dictionary fails ? Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-11 02:14 +0000
Re: Sorting a set works, sorting a dictionary fails ? Larry Hudson <orgnut@yahoo.com> - 2013-06-11 02:16 -0700
Re: Sorting a set works, sorting a dictionary fails ? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-06-10 11:19 +0200
csiph-web