Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26877
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <th982a@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'assign': 0.07; 'suppose': 0.07; 'python': 0.09; 'dict': 0.09; 'subject:into': 0.09; 'aug': 0.13; 'sat,': 0.15; 'dictionary,': 0.16; 'dictionary.': 0.16; 'helps!': 0.16; 'idx': 0.16; 'mapping,': 0.16; 'mean,': 0.16; 'unordered': 0.16; 'variable.': 0.16; 'wrote:': 0.17; 'keys': 0.22; 'received:mail-bk0-f46.google.com': 0.22; 'sorry,': 0.22; 'this:': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'looks': 0.26; 'charset:iso-8859-15': 0.26; 'am,': 0.27; 'question': 0.27; 'received:209.85.214.46': 0.27; 'start,': 0.27; 'chris': 0.28; 'represent': 0.28; 'dictionary': 0.29; 'points': 0.29; "skip:' 10": 0.30; 'certain': 0.33; '11,': 0.33; 'clarify': 0.33; 'values.': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'from:addr:googlemail.com': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'list,': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'end': 0.40; 'your': 0.60; 'more': 0.63; 'subject:....': 0.65; 'receive': 0.71 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=gktogn9mVLQqMB/gUzJ35O+0v43NVP8a5tleTwU0p+M=; b=RV62caaLF4uE0nBWTSW+AMSjvWoH+3j/fZVBfyM62vh8QF1USq8RtFPeki9p6OVpG1 bt/NDPzdyOH9br1IurZOv1BjGMISKnW6dWVK8ha6gAHSRkAoVIwwA89UIE05t1zRox6X JyQMQv10unU3Efd+eFa6eXZqxEm+0wGoLpfvssCNP6z7ROv0wg507bQEOnijlykBB3/U qNae2V72n7gVuOC//FZM4XNo9IvymhNJIcLI59uOZSLrPJSsPkkU2swPIVLtwxd3+ZsA 1eeCTX0z89Yp6yMGOQcbYK4d+AP2k9Cjc9x1AwnOoTJqEzdsGWjYRYNyj2omFCHJCyV4 3u2A== |
| Date | Fri, 10 Aug 2012 17:31:48 +0200 |
| From | Tamer Higazi <th982a@googlemail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120730 Thunderbird/10.0.6 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: dictionary into desired variable.... |
| References | <50251477.7010507@googlemail.com> <CAPTjJmpB-LiL=+WURP8O6Y=39CYtKuq_zVyVMsWv4qQdmEZFrw@mail.gmail.com> |
| In-Reply-To | <CAPTjJmpB-LiL=+WURP8O6Y=39CYtKuq_zVyVMsWv4qQdmEZFrw@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-15 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.3166.1344612712.4697.python-list@python.org> (permalink) |
| Lines | 61 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1344612712 news.xs4all.nl 6863 [2001:888:2000:d::a6]:54291 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:26877 |
Show key headers only | View raw
Sorry, I ment of course list.... what I exaclty ment is that if I assign value = Number that I automaticly assign y[1][3][6][1][1] a new number. more detailled explained: let us say a would be x = [2,5,4] y = a[3] if I change y to [] I want the result to be x = [2,5,[]] and that's automaticly independently how deep i dig. Sorry for the inconvenience. Tamer Am 10.08.2012 16:31, schrieb Chris Angelico: > On Sat, Aug 11, 2012 at 12:02 AM, Tamer Higazi <th982a@googlemail.com> wrote: >> Hi! >> suppose you have a dictionary that looks like this: >> >> x = [1,3,6,1,1] which should represent a certain other variable. >> >> in reality it would represent: >> >> y[1][3][6][1][1] >> >> Now, how do I write a python routine, that points in this dictionary, >> where I should receive or set other values. > > For a start, that looks like a list, not a dictionary. A dict in > Python is a mapping, eg a hashtable - an unordered pairing of keys and > values. But this might do what you want: > > value = y > for idx in x: > value = value[idx] > > At the end of that, 'value' will be the same as 'y[1][3][6][1][1]'. > > If that's not what you mean, you may want to clarify your question some. > > Hope that helps! > > Chris Angelico
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: dictionary into desired variable.... Tamer Higazi <th982a@googlemail.com> - 2012-08-10 17:31 +0200 Re: dictionary into desired variable.... woooee@gmail.com - 2012-08-10 10:04 -0700 Re: dictionary into desired variable.... woooee@gmail.com - 2012-08-10 10:04 -0700
csiph-web