資源簡介
通過使用招聘網站的體驗,發現對現在IT市場主流人才和技術需求缺乏宏觀的掌握。
通過運用python爬蟲技術,爬取大型主流招聘網站關于大數據人才的需求,并通過后臺分析,最終以玫瑰圖,漏斗圖,地圖的形式展示當下市場主要需求。
通過運用python爬蟲技術,爬取大型主流招聘網站關于大數據人才的需求,并通過后臺分析,最終以玫瑰圖,漏斗圖,地圖的形式展示當下市場主要需求。

代碼片段和文件信息
import?urllib.request
import?xlwt??????????????#使用xlwt模塊寫入Excel文件
import?re????????????????#正則表達式
import?urllib.parse??????#parse模塊的作用:url的解析,合并,編碼,解碼
import?time??????????????#時間模塊
#模擬瀏覽器
header={
????‘Host‘:‘search.51job.com‘
????‘Upgrade-Insecure-Requests‘:‘1‘
????‘User-Agent‘:‘Mozilla/5.0?(Linux;?Android?6.0;?Nexus?5?Build/MRA58N)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/75.0.3770.80?Mobile?Safari/537.36‘
}
def?getfront(pageitem):???????#page是頁數,item是輸入的字符串
?????result?=?urllib.parse.quote(item) #先把字符串轉成十六進制編碼
?????ur1?=?result+‘2‘+?str(page)+‘.html‘
?????ur2?=?‘https://search.51job.com/list/000000000000000000999‘
?????res?=?ur2+ur1 #拼接網址
?????a?=?urllib.request.urlopen(res)
?????html?=?a.read().decode(‘gbk‘)??????????#?讀取源代碼并轉為unicode
?????return?html
def?getInformation(html):
????#compile?函數用于編譯正則表達式,生成一個正則表達式(?Pattern?)對象,供?match()?和?search()?這兩個函數使用。
????reg?=?re.compile(r‘class=“t1?“>.*??tle=“(.*?)“?href=“(.*?)“.*??tle=“(.*?)“?href=“(.*?)“.*?(.*?).*?(.*?).*?(.*?).*?‘re.S)#匹配換行符
????items=re.findall(reghtml)
????return?items
#新建表格空間
excel1?=?xlwt.Workbook()
#新建一個sheet設置單元格格式cell_overwrite_ok=True防止對一個單元格重復操作引發的錯誤
sheet1?=?excel1.add_sheet(‘Job‘?cell_overwrite_ok=True)
sheet1.write(0?0?‘序號‘)
sheet1.write(0?1?‘職位‘)
sheet1.write(0?2?‘公司名稱‘)
sheet1.write(0?3?‘公司地點‘)
sheet1.write(0?4?‘公司性質‘)
sheet1.write(0?5?‘薪資‘)
sheet1.write(0?6?‘學歷要求‘)
sheet1.write(0?7?‘工作經驗‘)
sheet1.write(0?8?‘公司規模‘)
sheet1.write(0?9?‘公司類型‘)
sheet1.write(0?10‘公司福利‘)
sheet1.write(0?11‘發布時間‘)
number?=?1????#保存到excel中第幾條數據
item?=?input(‘請輸入崗位關鍵詞(與大數據相關職業):‘)
for?j?in?range(110000):???#頁數自己隨便改
????try:
????????print(“正在爬取第“+str(j)+“頁數據...“)
????????html?=?getfront(jitem)??????#調用獲取網頁原碼
????????for?i?in?getInformation(html):
????????????try:
????????????????‘‘‘
????????????????i[0]:職位
????????????????i[1]:職位網址
????????????????i[2]:公司名稱
????????????????i[4]:公司地點
????????????????i[5]:薪資
????????????????i[6]:發布時間
????????????????company[0][0]:公司性質
????????????????job_need[2][0]:學歷要求
????????????????job_need[1][0]:工作經驗
????????????????company[0][1]:公司規模
????????????????company[0][2]:公司類型
????????????????welfare:公司福利
????????????????‘‘‘
????????????????url1?=?i[1]??????????#職位網址
????????????????res1?=?urllib.request.urlopen(url1).read().decode(‘gbk‘)
????????????????company?=?re.findall(re.compile(r‘.*?tle=“(.*?)“>.*?tle=“(.*?)“>.*?
tle=“(.*?)“>.*?‘re.S)res1)
????????????????job_need?=?re.findall(re.compile(r‘
.*? | (.*?) | (.*?) | .*?
‘re.S)res1)
????????????????welfare?=?re.findall(re.compile(r‘
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????752640??2020-01-08?17:48??51job2.xls
?????文件????????4677??2020-01-07?16:03??51job_view.py
?????文件????????6796??2020-01-06?14:49??51job_view2.py
?????文件?????????646??2020-01-03?20:57??chowbai_error_info.txt
?????文件?????3671828??2020-01-08?17:48??大數據城市需求分布圖.html
?????文件?????3649615??2020-01-08?17:48??學歷要求餅圖.html
?????文件?????3647659??2020-01-08?17:48??工作經驗要求漏斗圖.html
?????文件?????3109888??2020-01-08?17:10??51job.xls
評論
共有 條評論
相關資源
- Python-BDD100K大規模多樣化駕駛視頻數據
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一個小小的表白程序(python)
- Python課堂筆記(高淇400集第一季)
- 二級考試python試題12套(包括選擇題和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安裝包 P
- 英文原版-Scientific Computing with Python
- 7.圖像風格遷移 基于深度學習 pyt
- 基于Python的學生管理系統
- A Byte of Python(簡明Python教程)(第
- Python實例174946
- Python 人臉識別
- Python 人事管理系統
- 15個pyqt5項目
- 基于python-flask的個人博客系統
- 計算機視覺應用開發流程
- python 調用sftp斷點續傳文件
- python socket游戲
- 基于Python爬蟲爬取天氣預報信息
- python函數編程和講解
- Python開發的個人博客
- 基于python的三層神經網絡模型搭建
- python實現自動操作windows應用
- python人臉識別(opencv)
- python 繪圖(方形、線條、圓形)
- python疫情卡UN管控