dictionary into desired variable....

woooee at gmail.com woooee at gmail.com
Fri Aug 10 13:04:41 EDT 2012


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



More information about the Python-list mailing list