getting info out of a list.

Jim Richardson warlock at eskimo.com
Mon Jun 16 21:24:30 EDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 16 Jun 2003 15:36:00 +0400,
 anton muhin <antonmuhin.REMOVE.ME.FOR.REAL.MAIL at rambler.ru> wrote:
> Jim Richardson wrote:
> 
>> I have the following code 
>> 
>> for wires in wirelist.keys():
>>         bits=wirelist[wires]
>>         Wire=("GW",wires,bits)
>>         print Wire
>> 
>> 
>> Which, depending on the data in wirelist, results in something like, 
>> 
>> ('GW', 1, (11, 0, -500, 0, 0, 500, 0, 10))
>> 
>> 
>> But what I want is 
>> 
>> ('GW', 1, 11, 0, -500, 0, 0, 500, 0, 10)
>> 
>> I want the tuple that is returned from the dict wirelist, to be added as
>> individual elements, rather than a tuple of individual elements, to the
>> list "bits"
>> 
>> (I hope I have explained this properly)
>> 
>> 
>> I know I am missing something fundamental, but I can't figure out what.
>> Any suggestions on where to look? or what I am missing? Thanks. 
>> 
>> 
>   And just my two cents: your for loop could be rewritten a little bit 
> more effeciently and (IMHO) clearly:
> 
> for wires, names in wirelist.iteritems():
>       Wire = ("GW", wires) + bits
>       print Wire
> 

Thanks, that is appreciated. I went to the docs, and it appears to be
something that came in after 2.0. Thanks :) 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+7m3Od90bcYOAWPYRAtSbAJ9V/1pXC0DmyW//6f0kY1kjrZkhkACg56dG
KUEkMn0fH7F2M+gc70GwIrw=
=aPZu
-----END PGP SIGNATURE-----

-- 
Jim Richardson         http://www.eskimo.com/~warlock

Linux, because eventually, you grow up enough to be trusted with a fork()




More information about the Python-list mailing list