getting info out of a list.
warlock at eskimo.com
Tue Jun 17 03:24:30 CEST 2003
-----BEGIN PGP SIGNED MESSAGE-----
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():
>> 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)
-----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