Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33240
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <thbach@students.uni-mainz.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'syntax': 0.03; 'python': 0.09; "'test": 0.09; '[])': 0.09; 'dict': 0.09; 'supported.': 0.09; 'subject:Help': 0.10; '"test': 0.16; '1",': 0.16; '2",': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'skip:` 20': 0.17; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '2.6': 0.27; 'subject:lists': 0.32; 'to:addr:python-list': 0.33; 'nov': 0.35; 'there': 0.35; '12,': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'content-disposition:inline': 0.60; 'received:10.94': 0.84; 'received:89': 0.86 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=uni-mainz.de; i=@uni-mainz.de; q=dns/txt; s=ironport; t=1352814914; x=1384350914; h=date:from:to:subject:message-id:references:mime-version: in-reply-to; bh=cByQMC5ztai+FrhXPKr0TrAbPsUZXI4sCWEiEB1oVJM=; b=TBcRYNUfFJXNLQMb/W6L+lsgRHJ0EWOyOQsTWq4TZJjyhtTDio58t9K6 LMNweHMOrpY5RV+8O8wayZ1OlkPpL8d/UKpBzjMcR9pbIhLRBlai/Tj0q JjUHRVztnt5PH8O9XQ7XcZqNRNmnEDo1m58KN1V19ayVEuxUEhGzVh7Bd M=; |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | ApwEABpQolAKXgZY/2dsb2JhbABExH6CHgEBBTpPCxgeEBQpIIghqV2QMIwhgy2CRmEDlXsBkEOCcIIY |
| Date | Tue, 13 Nov 2012 14:53:55 +0100 |
| From | Thomas Bach <thbach@students.uni-mainz.de> |
| To | <python-list@python.org> |
| Subject | Re: Help building a dictionary of lists |
| References | <9f44d1de-bccf-41ad-8529-ff8a65d7e2b4@googlegroups.com> <CAN1F8qX7p_DGutu-M4QAauyRN7CoZMDdvQ130DDERwrkHtvzFQ@mail.gmail.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Disposition | inline |
| In-Reply-To | <CAN1F8qX7p_DGutu-M4QAauyRN7CoZMDdvQ130DDERwrkHtvzFQ@mail.gmail.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| X-Originating-IP | [89.204.138.134] |
| 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.3626.1352814915.27098.python-list@python.org> (permalink) |
| Lines | 14 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1352814915 news.xs4all.nl 6943 [2001:888:2000:d::a6]:35685 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33240 |
Show key headers only | View raw
On Mon, Nov 12, 2012 at 11:41:59PM +0000, Joshua Landau wrote:
>
> Dict comprehension:
> {i:[] for i in ["Test 1", "Test 2", "Test 3"]}
In Python 2.6 this syntax is not supported. You can achieve the same
there via
dict((i, []) for i in ['Test 1', 'Test 2', 'Test 3'])
Also have a look at ``collections.defaultdict``.
Regards,
Thomas.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Help building a dictionary of lists NJ1706 <nickj1706@googlemail.com> - 2012-11-12 14:26 -0800 Re: Help building a dictionary of lists Thomas Bach <thbach@students.uni-mainz.de> - 2012-11-13 14:53 +0100
csiph-web