Python 协程

def GenerateProcess():
    filelocal = r'c:\Te'
    for i in range(10):
        baiWei = i * 100
        filename = [None] * 100
        filelocalation = [None] * 100
        for j in range(100):
            filename_pre = baiWei + j + 1
            filename[j] = "%s.avi" % filename_pre
            filelocalation[j] = filelocal + "\\" + filename[j]
        print filelocalation
        yield multiprocessing.Process(target=upload, args=(filename, filelocalation))

def ExecuteProcess(G):
    h = G.next()
    for i in range(10):
        h.start()
        h = G.send('')

if __name__=='__main__':

    a = GenerateProcess()
    ExecuteProcess(a)

 

posted on 2016-01-13 20:44  小作一个  阅读(197)  评论(0编辑  收藏  举报

导航