Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103288
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2016-02-21 05:34 -0800 |
| Message-ID | <554c09f2-6a6b-4576-9c9d-50d6234c8583@googlegroups.com> (permalink) |
| Subject | how to get the list form dictionary's values |
| From | davidbenny2000@gmail.com |
File "mainpy.py", line 81
for functionlistelement in functionlist0
^
SyntaxError: invalid syntax
import asyncio
def f000():
try:
print "000"
except:
print "000 exception"
def f001():
try:
print "001"
except:
print "001 exception"
def f002():
try:
print "002"
except:
print "002 exception"
def f003():
try:
print "003"
except:
print "003 exception"
def f004():
try:
print "004"
except:
print "004 exception"
machine = {}
mappedfunc = {}
functionlist000 = []
functionlist001 = []
functionlist002 = []
functionlist003 = []
functionlist004 = []
functionlist000.append('002')
functionlist001.append('000')
functionlist002.append('003')
functionlist002.append('004')
functionlist003.append('001')
functionlist004.append('001')
machine000 = {'000': functionlist000}
machine001 = {'001': functionlist001}
machine002 = {'002': functionlist002}
machine003 = {'003': functionlist003}
machine004 = {'004': functionlist004}
machine.update(machine000)
machine.update(machine001)
machine.update(machine002)
machine.update(machine003)
machine.update(machine004)
functionkey000 = {'000': f000 }
functionkey001 = {'001': f001 }
functionkey002 = {'002': f002 }
functionkey002 = {'003': f003 }
functionkey002 = {'004': f004 }
mappedfunc.update(functionkey000)
mappedfunc.update(functionkey001)
mappedfunc.update(functionkey002)
mappedfunc.update(functionkey003)
mappedfunc.update(functionkey004)
def workingthreadpool(currentnumber1, machine1):
try:
functionlist0 = machine1.get(currentnumber1)
loop = asyncio.get_event_loop()
tesks = []
j = 1
for functionlistelement in functionlist0
tesks.append(asyncio.ensure_future(mappedfunc.get(functionlistelement)()))
if j > 1:
workingthreadpool(functionlistelement)
j = j + 1
loop.run_until_complete(asyncio.wait(tesks))
loop.close()
except:
print "workingthreadpool exception"
currentnumber = "000"
workingthreadpool(currentnumber, machine)
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
how to get the list form dictionary's values davidbenny2000@gmail.com - 2016-02-21 05:34 -0800
Re: how to get the list form dictionary's values Chris Angelico <rosuav@gmail.com> - 2016-02-22 01:04 +1100
Re: how to get the list form dictionary's values Ho Yeung Lee <davidbenny2000@gmail.com> - 2016-02-21 06:15 -0800
Re: how to get the list form dictionary's values Chris Angelico <rosuav@gmail.com> - 2016-02-22 02:01 +1100
Re: how to get the list form dictionary's values Marko Rauhamaa <marko@pacujo.net> - 2016-02-21 17:16 +0200
Re: how to get the list form dictionary's values Peter Otten <__peter__@web.de> - 2016-02-21 15:06 +0100
Re: how to get the list form dictionary's values Ho Yeung Lee <davidbenny2000@gmail.com> - 2016-02-21 06:21 -0800
csiph-web