Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 带有For循环的Python多线程_Python 3.x_Multithreading_For Loop_If Statement - Fatal编程技术网

Python 3.x 带有For循环的Python多线程

Python 3.x 带有For循环的Python多线程,python-3.x,multithreading,for-loop,if-statement,Python 3.x,Multithreading,For Loop,If Statement,我正在尝试使用多线程运行以下代码以提高速度 到目前为止,我尝试过的每件事都只是对每个线程重复相同的迭代,而不是开始下一个。 谢谢 阵列中x的: 全局计数 response=requests.get(x,proxies=proxies,headers=headers) content=response.text o=内容。查找(联机) ago=re.findall(((Show\n[0-9][^.]*?ago)”,内容) ago=''。加入(ago)。替换('Show\n','')。替换(“月”,

我正在尝试使用多线程运行以下代码以提高速度

到目前为止,我尝试过的每件事都只是对每个线程重复相同的迭代,而不是开始下一个。 谢谢

阵列中x的
:
全局计数
response=requests.get(x,proxies=proxies,headers=headers)
content=response.text
o=内容。查找(联机)
ago=re.findall(((Show\n[0-9][^.]*?ago)”,内容)
ago=''。加入(ago)。替换('Show\n','')。替换(“月”,“月@@”)。替换(“月”,“月@”)。替换(“周”,“周@”)。替换(“年”,“年@”)。替换(“年”,“年@”)
如果是内容。查找(在线)!=-1:
计数=计数+1
打印(Fore.GREEN+“联机:”,x)
elif content.find(指行)!=-1:
打印(Fore.RED+x,“-”,“上次联机:”,前)
其他:
打印(Style.RESET_ALL,“未知:”,o,x)
    for x in array:
        global count
        response = requests.get(x, proxies=proxies, headers=headers)
        content = response.text
        o = content.find(online)
        ago = re.findall("(Show</span>\n[0-9][^.]*?ago)", content)
        ago = ''.join(ago).replace('Show</span>\n', '').replace("months", "MOUNTHS@@@").replace("month", "MOUNTH@@@").replace("weeks", "WEEKS@@@").replace("year", "YEAR@@@").replace("years", "YEARS@@@")
        if content.find(online) != -1:
            count = count + 1
            print(Fore.GREEN + 'Online:', x)
        elif content.find(ofline) != -1:
            print(Fore.RED + x, "-", 'Last Online:',ago)
        else:
            print(Style.RESET_ALL, 'Unknown:', o, x)