Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109799
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Random832 <random832@fastmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: fast dictionary initialization |
| Date | Fri, 10 Jun 2016 17:15:46 -0400 |
| Lines | 15 |
| Message-ID | <mailman.142.1465593350.2306.python-list@python.org> (permalink) |
| References | <d2ee0910-1635-431e-944c-c8b4167f10c5@googlegroups.com> <1465593346.2349149.634242025.11CE5139@webmail.messagingengine.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de nqynbttRjJy+BkT/083OqwjmLBqPmD86WaLBcKMfUxyQ== |
| Return-Path | <random832@fastmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'initialize': 0.05; 'sized': 0.07; 'received:internal': 0.09; 'example:': 0.10; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'string': 0.17; 'basically': 0.18; 'keys': 0.22; 'subject:skip:i 10': 0.22; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'dictionary': 0.29; 'convert': 0.29; 'skip:[ 10': 0.31; 'list': 0.34; 'list,': 0.36; 'lines': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'header:Message- Id:1': 0.61 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=tbr0e+8aXg8D246vK5wCcJoholM=; b=qi6gPo KeseREXSGFLUMIZ45vOTh7o80K1hDNDTDs1aj5MdXnzHTSWgU6h6vRpYrigJ5FQv 3cDiu1aVPpckL0df3Z3x0EOgdvauKDjQ1DaDAqZ0PLW+Nr8FIQHc/zWO8y/btedm AHw83Ezz0vlsFy5TlG9K2Hss8oKVN34XaUPfQ= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=tbr0e+8aXg8D246 vK5wCcJoholM=; b=hF7UCM1SAs9y5Nha2REeDrZ2eQTDkBRNBqFE3xSVOfG+s37 uBgg3mVTs/ClK1niKkAaeGFOZbYmWInxR31cy7gUw36XVKexGCrI5ykAN23ATupX ns2EX5x5s6wpf6n+JOciwAK0FtNap8rAu7oht33Ucr5IjmWm3k9/9Cf78nM4= |
| X-Sasl-Enc | LolnrMEdgS/qZ3wSNW1LxdxMn655V6xy73RjkxzxijSF 1465593346 |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-aff28cd1 |
| In-Reply-To | <d2ee0910-1635-431e-944c-c8b4167f10c5@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <1465593346.2349149.634242025.11CE5139@webmail.messagingengine.com> |
| X-Mailman-Original-References | <d2ee0910-1635-431e-944c-c8b4167f10c5@googlegroups.com> |
| Xref | csiph.com comp.lang.python:109799 |
Show key headers only | View raw
pOn Fri, Jun 10, 2016, at 17:07, maurice wrote:
> Hi. If I have already a list of values, let's call it valuesList and the
> keysList, both same sized lists, what is the easiest/quickest way to
> initialize a dictionary with those keys and list, in terms of number of
> lines perhaps?
>
> example:
> valuesList = [1,2,3]
> keysList = ['1','2','3']
>
> So the dictionary can basically convert string to int:
>
> dictionary = {'1':1, '2':2, '3':3}
dict(zip(keysList, valuesList))
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fast dictionary initialization maurice <mauricioliveiraguarda@gmail.com> - 2016-06-10 14:07 -0700 Re: fast dictionary initialization Random832 <random832@fastmail.com> - 2016-06-10 17:15 -0400 Re: fast dictionary initialization Tim Chase <python.list@tim.thechases.com> - 2016-06-10 18:20 -0500
csiph-web