网络爬虫

import requests
import json
r=requests.get("https://edu.cnblogs.com/Homework/GetAnswers?homeworkId=2420&_=1543846454903")
data=json.loads(r.text)['data']  
info="" 
for a in data:
    info += str(a['StudentNo'])+','+a['RealName']+','+a['Title']+','+a['DateAdded']+','+a['Url']+'\n'        
with open('hwlist.csv','w')as f:
    f.write(info)

网络爬虫_第1张图片

你可能感兴趣的:(网络爬虫)