上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
摘要: 效果如下: 阅读全文
posted @ 2020-02-18 15:31 袁小丑 阅读(1256) 评论(1) 推荐(1) 编辑
摘要: 中国卫生健康委员会网站具有反爬取功能,并需加入请求头,并且cookie每隔很短时间就会刷新一次,因此每次爬取都需要更换一下cookie 爬取数据如下: 阅读全文
posted @ 2020-02-15 10:15 袁小丑 阅读(1227) 评论(1) 推荐(0) 编辑
摘要: 丁香园中数据是由js加载出来的,因此需要用正则去截取数据,最后转成json或其他数据形式并处理 爬取代码: import pymysql import requests import pprint import re import json def write_to_file(item): with 阅读全文
posted @ 2020-02-14 20:11 袁小丑 阅读(1760) 评论(0) 推荐(0) 编辑
摘要: 有些你想爬取的页面数据并不在html里,而是由js动态加再出来,所以xpath不能提取出想要的数据,有些需要用到正则表达式,例如爬取丁香园疫情数据: import requests import re import json reault=requests.get('https://ncov.dxy 阅读全文
posted @ 2020-02-13 15:38 袁小丑 阅读(457) 评论(0) 推荐(0) 编辑
摘要: python3连接mysql的方式: def mysql_(): conn = pymysql.connect(host='127.0.0.1', user='用户名', passwd='密码', db='数据库', port=3306, charset='utf8', cursorclass=py 阅读全文
posted @ 2020-02-12 11:40 袁小丑 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 河北省卫生健康委员会关于疫情的通报格式一般为如下格式:因此可以通过改变爬取地址去爬取所有疫情数据。 代码如下: from lxml import etree import re import requests def info(url): strhtml = requests.get(url) # 阅读全文
posted @ 2020-02-11 16:11 袁小丑 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 爬取河北省卫生健康委员会疫情通报标题目录,由于标题中有其他通报,所以需要筛选出所有关于疫情情况的标题,并爬取地址链接,代码如下: from lxml import etreeimport reimport requests def get_url(url): strhtml = requests.g 阅读全文
posted @ 2020-02-10 16:04 袁小丑 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 将下列 json 数据复制到你的 ubuntu 系统/usr/local/spark 下,并保存命名为 employee.json。 { "id":1 ,"name":" Ella","age":36 } { "id":2,"name":"Bob","age":29 } { "id":3 ,"nam 阅读全文
posted @ 2020-02-09 14:02 袁小丑 阅读(1127) 评论(0) 推荐(0) 编辑
摘要: 数据集: Tom,DataBase,80 Tom,Algorithm,50 Tom,DataStructure,60 Jim,DataBase,90 Jim,Algorithm,60 Jim,DataStructure,80 …… 请根据给定的实验数据,在 spark-shell 中通过编程来计算以 阅读全文
posted @ 2020-02-08 13:08 袁小丑 阅读(1736) 评论(0) 推荐(0) 编辑
摘要: 学生的成绩清单格式如下所示,第一行为表头,各字段意思分别为学号、性别、课程名 1、课程名 2 等,后面每一行代表一个学生的信息,各字段之间用空白符隔开 Id gender Math English Physics 301610 male 80 64 78 301611 female 65 87 58 阅读全文
posted @ 2020-02-07 15:45 袁小丑 阅读(4864) 评论(1) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页