Re: Possible to have multiple loop variables?
- From: Alan Franzoni <alan.franzoni.blahblah@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 08:44:08 GMT
laredotornado was kind enough to say:
How would I set up the ms1 array such that I can use three items per
object?
Use tuples. But that should depend on which values make up the key for your
mapping.
E.g.
ms1 = {('managed1':7019):8020, ('managed2':7020):8021}
ms2 = {'managed1':(7019:8020), 'managed2':(7020:8021)}
depending on what you want, and then iterate over such structure just like
Marc suggested.
Otherwise, you can create a custom class which returns three-tuples when
iterated, in such case you can just extract m, lp, ssl_lp in the for cycle
just like your example.
--
Alan Franzoni <alan.franzoni.xyz@xxxxxxxxx>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
.
- References:
- Possible to have multiple loop variables?
- From: laredotornado
- Possible to have multiple loop variables?
- Prev by Date: Re: Python parsing iTunes XML/COM
- Next by Date: Re: interpreter vs. compiled
- Previous by thread: Re: Possible to have multiple loop variables?
- Next by thread: how to split text into lines?
- Index(es):
Relevant Pages
|