qq_31480029
qq_31480029
2017-02-01 17:04

使用python爬虫解析json

  • 爬虫
  • python
  • 源码

报错
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
源码

-*- coding:utf-8 -*-

import requests
from openpyxl import Workbook

url='https://www.lagou.com/jobs/positionAjax.json?px=default&city=上海&needAddtionalResult=false'
page=1
lang_name='python'
def get_json(url,page,lang_name):
data={'first':True,'pn':page,'kd':lang_name}
json_data=requests.post(url).json()

#list_con=json_data['content']['positionResult']['result']
print(json_data['content']['positionResult']['result'])

get_json(url,page,lang_name)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答