Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80591
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrote': 0.14; '(x,': 0.16; 'caveat': 0.16; 'dictionary,': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'header:X -Complaints-To:1': 0.27; 'keys': 0.31; 'writes:': 0.31; 'lists': 0.32; 'compatible': 0.32; 'one,': 0.35; 'subject:lists': 0.35; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'such': 0.63; 'wish': 0.70 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re: Combining lists to dictionary |
| Date | Wed, 12 Nov 2014 01:13:33 -0500 (EST) |
| Organization | news.gmane.org |
| References | <m3tscl$f1e$2@dont-email.me> <85tx255ib8.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 97.73.240.77 |
| X-Newsreader | PiaoHong.Usenet.Client.VIP:1.65 |
| X-Archive | encrypt |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15714.1415772907.18130.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1415772907 news.xs4all.nl 2868 [2001:888:2000:d::a6]:35556 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:80591 |
Show key headers only | View raw
Ben Finney <ben+python@benfinney.id.au> Wrote in message:
> Denis McMahon <denismfmcmahon@gmail.com> writes:
>
>> Hi
>>
>> Given x,y are a lists of keys and value that I wish to combine to a
>> dictionary, such that x[n] is the key for value y[n], which is preferred:
>>
>> z = {a:b for (a,b) in zip(x,y)}
>
> This one, with the caveat to use PEP-8 compatible formatting::
>
> z = {a: b for (a, b) in zip(x, y)}
Or just z = dict(zip (x, y))
>
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Combining lists to dictionary Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-11 20:43 +0000 Re: Combining lists to dictionary Gary Herron <gherron@digipen.edu> - 2014-11-11 12:55 -0800 Re: Combining lists to dictionary Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-11-11 13:42 -0800 Re: Combining lists to dictionary Roy Smith <roy@panix.com> - 2014-11-11 20:06 -0500 Re: Combining lists to dictionary Ben Finney <ben+python@benfinney.id.au> - 2014-11-12 12:16 +1100 Re: Combining lists to dictionary Dave Angel <davea@davea.name> - 2014-11-12 01:13 -0500
csiph-web