Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26881

Re: dictionary into desired variable....

Newsgroups comp.lang.python
Date 2012-08-10 10:04 -0700
References <50251477.7010507@googlemail.com> <CAPTjJmpB-LiL=+WURP8O6Y=39CYtKuq_zVyVMsWv4qQdmEZFrw@mail.gmail.com> <mailman.3166.1344612712.4697.python-list@python.org>
Subject Re: dictionary into desired variable....
From woooee@gmail.com
Message-ID <mailman.3169.1344618284.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Friday, August 10, 2012 8:31:48 AM UTC-7, Tamer Higazi wrote:
> 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

There is no such thing as a[3] if a=[2,4,5].  And this is a list not a dictionary, so I would suggest a tutorial from the Python wiki page.

You have to use a mutable container.  Integers are not mutable.  Lists, for example are.

y=[4]
x = [2,5,y]
print x
y[0]=10
print x

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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