所以我需要一种同时运行多次的方法,同时异步同一模块。我知道在python 3中有asynco的东西,但是如何在python 2中做到这一点?有什么想法吗?
这是代码示例:
MainPython.py
insert into ' +@DB + '.[Tforms](id, [tablename])
select max_id + row_number() over (order by id) as id, @newtbn
from (select t.*, max(id) over () as max_id
from '+ @DB+ '.[Tforms] t
) t
where tid = ' +str(@sourcetid) ;
SecondPython.py
from SecondPython import Single
mydata = {"1": {"stat": ""}, "2": {"stat": "1"}, "3": {"stat": ""}}
cnt = 0
for i in range(len(mydata.keys())):
result = Single(mydata, "browser")
if result == 101:
print "do this"
cnt += 1
if cnt >= 5:
break
else:
print "do thata"