2019年8月1日

初识python 之 爬虫:使用正则表达式爬取“古诗文”网页数据

摘要: 通过requests、re(正则表达式) 爬取“古诗文”网页数据。 详细代码如下: #!/user/bin env python # author:Simple-Sir # time:2019/7/31 22:01 # 爬取古诗文网页数据 import re import requests def 阅读全文

posted @ 2019-08-01 17:29 Simple-Sir 阅读(949) 评论(0) 推荐(0) 编辑

初识python 之 爬虫:正则表达式

摘要: 语法 python中正则表达式功能由 re 模块提供: import re 两个主要函数: match 匹配第一个字符(从第一个字符开始匹配) search 匹配整个字符串 一、匹配单个字符 1、匹配某个字符(串) text = 'hello' ret = re.match('hel',text) 阅读全文

posted @ 2019-08-01 16:27 Simple-Sir 阅读(306) 评论(0) 推荐(0) 编辑

导航