Пытался через библиотеку ‘Numba’, но слишком много действий для jit'a и выполнение завершается.
import requests import random from numba import njit, cuda filenames = ['input7.txt', 'input8.txt'] def run(): try: while 5 > 1: browser = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) ' +\ 'AppleWebKit/537.36 (KHTML, like Gecko) ' +\ 'Chrome/71.0.3578.98 Safari/537.36' headers = {'User-Agent': browser} pageNum1 = random.randrange(1,1000000) pageNum2 = random.randrange(1,1000000) fullurl = ['http://localhost/'+str(pageNum1),'http://localhost/'+str(pageNum2)] for url in fullurl: html = requests.get(url=url, headers=headers).text print (url) for filename in filenames: with open(filename) as f: for line in f: if line.rstrip() in html: print(f'Find "{line}" on the page {url}') with open('find.txt', 'a') as appendFile: appendFile.write('{}\n'.format(url)) appendFile.write('{}\n'.format(line)) return except (ValueError): print ("Break") run()