首页 > 技术文章 > Python 协程

haoshine 2016-01-13 20:44 原文

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)

 

推荐阅读