摘要: import urllib.requestimport reclass neiHan: #初始化页面 def __init__(self): self.page=1; #设置爬取开关 self.switch=True;#下载模块 def loadPage(self): # 获得网址,网页页面设置 u 阅读全文
posted @ 2021-04-11 16:16 名狐1993 阅读(118) 评论(0) 推荐(0)
摘要: import urllib.requestimport re#获得网址url="https://yuedu.mipang.com/hchj/neihan/page-3.html"#浏览器表头headers= {"User-Agent" : "Mozilla/5.0 (Macintosh; Intel 阅读全文
posted @ 2021-04-11 16:14 名狐1993 阅读(106) 评论(0) 推荐(0)
摘要: 因为自己将文件命名为re.py导致错误,改为re1.py就正常了(文件安装包名称也不能为re), 阅读全文
posted @ 2021-03-25 23:32 名狐1993 阅读(29) 评论(0) 推荐(0)
摘要: import urllib.request#构建一个Handler处理器,传入一个代理iphttpSwitch=urllib.request.ProxyHandler({"http":"120.232.175.244:80"})#构建一个opene对象openr=urllib.request.bui 阅读全文
posted @ 2021-02-16 00:07 名狐1993 阅读(71) 评论(0) 推荐(0)
摘要: coding=utf-8#Version:python3.7.4#Tools:Pycharm 2018.3.5_date_ = '2020/8/2 22:26 'import urllib.requestimport urllib.parseurl="https://tieba.baidu.com/ 阅读全文
posted @ 2020-08-06 19:50 名狐1993 阅读(155) 评论(0) 推荐(0)
摘要: #coding=utf-8#Version:python3.7.4#Tools:Pycharm 2018.3.5_date_ = '2020/7/13 23:42 'import urllib.requestimport urllib.parseurl="https://tieba.baidu.co 阅读全文
posted @ 2020-07-24 00:07 名狐1993 阅读(237) 评论(0) 推荐(0)
摘要: import urllib.requestimport urllib.parseurl="https://tieba.baidu.com/f"word=input("请输入要爬的贴吧")#将贴吧名称变成url码word=urllib.parse.quote(word)#完整输入贴吧链接newUrl= 阅读全文
posted @ 2020-07-13 23:47 名狐1993 阅读(239) 评论(0) 推荐(0)
摘要: 路径没有多加一个\写成\\ 阅读全文
posted @ 2020-06-23 11:43 名狐1993 阅读(202) 评论(0) 推荐(0)
摘要: 重新建项目,创建的时候勾选“inherit global site-packages”,即可解决 阅读全文
posted @ 2020-06-22 15:41 名狐1993 阅读(1508) 评论(0) 推荐(0)
摘要: import urllib.requestuil=urllib.request.urlopen("http://www.baidu.com")html=uil.read()print(html) 阅读全文
posted @ 2020-06-22 14:51 名狐1993 阅读(249) 评论(1) 推荐(0)