python程序和注释如下
#python requests测试
from bs4 import BeautifulSoupimport requests
from urllib import request
import re
import time
import threading
#打开文件
#伪装浏览器
headers = {'User-Agent' : r'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)' }
address='http://sou.zhaopin.com/jobs/searchresult.ashx?jl=653&kw=c%2b%2b&sm=0&sg=6729587202404b258ac42bedd469d049&p='
max_thread_count=11 #定义最大线程数
threadlist=[] #定义线程链表
thread=list(range(15)) #range(15)不是list类型的所以必须先转化为list类型
def spider(y,address,headers):
print("thread is start",y)
address = address+str(y)
req=request.Request(address, headers=headers)