[pygtk] Doubt about tuple assignment

Paolo Bacci paolobacci at gmail.com
Fri Jun 13 05:10:16 WST 2008


Hi,
I'm trying to assign a value into a specific position in a tuple but I
figured out that is not simple to do that and I nees a little help.

I have this input:

> a =3D [ (1,2) , (3,4) , (5,6) ]
>

And I want this output:

> a =3D [ (1,2) , (3,*0*) , (5,6) ]


I just want to change position a[1][1] from this tuple

I tried with the python cmd line some inputs but the closest I got was this
one:

a =3D a[:2-1] + (3,0) + a[2:]


Note that [2-1], the number 2 will be replaced to a var in my final code.

But my outpu is being:

(1,2) , (3,0), *0* , (5,6)


How can I take this 0 from the tuple and make it the right way?

Thanks,
Paolo Bacci.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080612/edd2a3e2/at=
tachment.htm


More information about the pygtk mailing list