Python笔记22-通过多开窗口的方式实现任务并行

#bbb.py
import sys

if __name__ == '__main__':

    start = sys.argv[1]
    end = sys.argv[2]

    print(start)
    print(type(start))
    print(end)

    input('press any key')
#ccc.py
import subprocess
import os


path = os.path.dirname(os.path.realpath(__file__)) + '/'
if __name__ == '__main__':
    start = '20181231'
    end = '20121231'
    py = 'bbb'
    pycmd = f'start /wait python {path}{py}.py {start} {end}'
    print(pycmd)
    thread_process = subprocess.call(pycmd, shell=True)

设好参数可以并行跑多个任务了

你可能感兴趣的:(Python笔记22-通过多开窗口的方式实现任务并行)