赞
踩
# -*- coding: utf-8 -*- import requests import threading class GetRequests: def __init__(self): self.url = "http://www.baidu.com" def requestGetMethod(self): r = requests.get(self.url) print(r.text) print("==========================================================================") def threadBuild(): req = GetRequests() return req.requestGetMethod() try: i = 0 threadnums = 10 #线程数 while i < threadnums: re = threading.Thread(target=threadBuild) re.start() i += 1 except Exception as e: print(e)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。