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)
原文地址:https://www.cnblogs.com/haoshine/p/5128455.html