import urllib.request
import re
url = "https://search.51job.com/list/150200,000000,0000,00,9,99,java,2,1.html?lang=c&stype=&postchannel=0000&workyear=99&cotype=99°reefrom=99&jobterm=99&companysize=99&providesalary=99&lonlat=0%2C0&radius=-1&ord_field=0&confirmdate=9&fromType=&dibiaoid=0&address=&line=&specialarea=00&from=&welfare="
def query(url):
html = ""
try:
response = urllib.request.urlopen(url)
html = str(response.read().decode("gbk"))
except:
print("access error")
restr = """<div class="rt">([sS]*?)</div>"""
regex = re.compile(restr, re.IGNORECASE)
mylist = regex.findall(html)
# 数据包含换行空格等字符
data = mylist[0].strip()
print(data)
# 提取职位数
restr = "(\d+)"
regex = re.compile(restr, re.IGNORECASE)
mylist = regex.findall(data)
print(mylist[0])
query(url)
最后
以上就是犹豫大侠最近收集整理的关于从51job提取职位数量的全部内容,更多相关从51job提取职位数量内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复