当前位置: 首页>>代码示例>>Python>>正文


Python Job.salary_low方法代码示例

本文整理汇总了Python中models.Job.salary_low方法的典型用法代码示例。如果您正苦于以下问题:Python Job.salary_low方法的具体用法?Python Job.salary_low怎么用?Python Job.salary_low使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Job的用法示例。


在下文中一共展示了Job.salary_low方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getJobInfo

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import salary_low [as 别名]
def getJobInfo(dom, company):
    '''获取一个职位的招聘信息'''

    job_info = {}
    type_tr = dom('.jobInfoItems tr:eq(0)')
    trtext = type_tr.text()
    trtext = trtext.split(u':') if trtext else []
    if len(trtext) == 2:
        k, v = trtext
        v = v.replace('/', ',')
        job_info[k] = v

    trs = dom('.jobInfoItems tr:gt(1)')
    for tr in trs:
        tr = pq(tr)
        tds = tr('td')
        for td in tds:
            td = pq(td)
            tdtext = td.text().split(u':')
            if len(tdtext) == 2:
                k, v = tdtext
                job_info[k] = v
    
    salary = job_info.get(u'职位月薪')
    if salary:
        sh = re.search(r'(\d+)-(\d+)', salary)
        salary = sh.groups() if sh else (None, None)
    else:
        salary = (None, None)
    quantity = job_info.get(u'招聘人数')
    if quantity:
        sh = re.search(r'(\d+)', quantity)
        quantity = sh.group(0) if sh else None

    job = Job()
    occ_type = job_info.get(u'职位类别')
    occ = Occupational.query.filter(Occupational.type==occ_type).first()
    if not occ:
        occ = Occupational()
        occ.name = 'FILL'
        occ.type = occ_type
        db.session.add(occ)
    job.occupational = occ
    job.type = job_info.get(u'工作性质')
    job.exp = job_info.get(u'工作经验')
    job.manage_exp = job_info.get(u'管理经验')
    job.quantity = quantity
    job.degree = job_info.get(u'最低学历')
    job.salary_low, job.salary_high = salary
    job.description = dom('.jobDes').html()
    job.etag = ''

    return job
开发者ID:Genieliu,项目名称:job-hunter,代码行数:55,代码来源:job_spider.py


注:本文中的models.Job.salary_low方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。