Possible to have multiple loop variables?

laredotornado laredotornado at zipmail.com
Wed Jul 30 19:49:58 CEST 2008


I don't know why I thought this would work, but I would like to have 3
variables in my for loop per iteration.  Those familiar will know that
this

ms1 = {'managed1':7019:8020,'managed2':7020:8021}
for m, lp, ssl_lp in ms1.items():
      managedServer = create(m,'Server')
      print 'creating managed server '+m
      managedServer.setListenAddress('147.191.71.70')
      managedServer.setListenPort(lp)
      managedServer.setEnabled(0)
      cd('SSL/cgServer')
      managedServer.setEnabled(1)
      managedServer.setListenPort(ssl_lp)
      managedServer.setCluster(clus1)

causes

  File "/export/third-party/etsbea/home/etsbea/tests/wlst/
createcluster.py", line 9
        ms1 = {'managed1':7019:8020,'managed2':7020:8021}
                              ^
SyntaxError: invalid syntax


How would I set up the ms1 array such that I can use three items per
object?

Thanks, - Dave



More information about the Python-list mailing list