我怎样才能按键中断ctrl + c?

时间:2019-12-05 06:44:54

标签: python python-3.x network-programming

full coding

start = time.time()
file = open('python.txt', 'r', encoding="ISO-8859-1")
urls = file.readlines()

p = Pool(processes=1)
try:
    result = p.map(checkurl, urls)
    p.close()
    p.join()
    print("done in : ", time.time() - start)
except KeyboardInterrupt:
    print('ctrl+c on!')
    p.terminate()
    p.join()

0 个答案:

没有答案