import codecs import random import os import time fpath=__file__ fpath=fpath.replace('cases_click_curl.py','cases.csv') print(fpath) lst=[] fr=codecs.open(fpath,'r','utf-8') lines=fr.readlines() for l in lines: elmts=l.split(',') lst.append('https://www.hhh.com.tw'+elmts[0]) fr.close() #for i in range(20): while True: l=random.choice(lst) os.system('docker run --rm curlimages/curl:7.79.1 -L -v '+l) # os.system('curl '+l) time.sleep(4) print(l)