您当前的位置: 首页 >  Python

嗨学编程

暂无认证

  • 0浏览

    0关注

    1405博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Python爬取前程无忧网址,并保存为txt文件

嗨学编程 发布时间:2019-08-02 15:12:29 ,浏览量:0

####开发工具

  • Python版本:3.6
  • 相关模块:
import urllib.request
import re

####完整代码

import urllib.request
import re
'''
遇到不懂的问题?Python学习交流群:1136201545满足你的需求,资料都已经上传群文件,可以自行下载!
'''
def get_html(page):                 #获取网页的HTML
    url = 'http://search.51job.com/jobsearch/search_result.php?fromJs=1&jobarea=000000%2C00&district=000000&funtype=0000&industrytype=00&issuedate=9&providesalary=99&keyword=Python&keywordtype=2&curr_page=2&lang=c&stype=1&postchannel=0000&workyear=99&cotype=99°reefrom=99&jobterm=99&companysize=99&lonlat=0%2C0&radius=-1&ord_field=0&list_type=0&fromType=14&dibiaoid=0&confirmdate=9'.format(page)
    html = urllib.request.urlopen(url).read()
    html = html.decode('gbk')
    return html

def get_you_want(html):         #获取需要的征文内容
    reg = re.compile(r'class="t1 ">.*?            
关注
打赏
1663681728
查看更多评论
0.1494s