摘要: 一、 SSM中bean的创建 在springboot中可以不写xml文件,改为用@Configuration的方式,告诉Spring boot这是一个配置类 ~~~ 配置文件 //通过注解方式@Bean来给容器中添加组件,类似于在配置文件.xml中配置<bean id="" class=""><pr 阅读全文
posted @ 2021-06-27 16:38 YuyuFishSmile 阅读(278) 评论(0) 推荐(0)
摘要: 一、 在主程序中配置 @SpringBootApplication 相当于: //@SpringBootConfiguration @Configuration //主要由他组成 //@EnableAutoConfiguration @AutoConfigurationPackage @Import 阅读全文
posted @ 2021-06-27 15:07 YuyuFishSmile 阅读(143) 评论(0) 推荐(0)
摘要: from bs4 import BeautifulSoup import requests import time import os def get_photo(key): url = "https://desk.zol.com.cn/meinv/"+str(key)+".html" resp = 阅读全文
posted @ 2021-06-24 16:35 YuyuFishSmile 阅读(314) 评论(0) 推荐(0)
摘要: import requests from bs4 import BeautifulSoup import time url = "http://www.bizhi360.com/meinv/" resp = requests.get(url) resp.encoding = "utf-8" #pri 阅读全文
posted @ 2021-06-24 16:33 YuyuFishSmile 阅读(325) 评论(0) 推荐(0)
摘要: 当网址有加密发送安全证书时可以使用verify=False,因为dytt利用的字符编码是gb2312,所以解码也要用gb2312 import requests domain = "https://dy.dytt8.net/index.htm" resp = requests.get(domain, 阅读全文
posted @ 2021-06-23 14:12 YuyuFishSmile 阅读(996) 评论(0) 推荐(0)
摘要: 思路:通过requests获取html前端代码,通过re进行正则匹配,最后存储进csv中 首先导入requests、re、csv 之后再定义一个爬取的方法函数,通过观察url请求发现参数有start和filter,发现传递的参数中以25作为基准,所以在这里定义一个方法用来传递参数 def get_d 阅读全文
posted @ 2021-06-23 11:21 YuyuFishSmile 阅读(112) 评论(0) 推荐(0)
摘要: re解析(运行速度最快) . 匹配换行符以外的任意字符 \w 匹配字母或数字或下划线 \s 匹配任意的空白符 \d 匹配数字 \n 匹配一个换行符 \t 匹配一个制表符 ^ 匹配字符串的开始 $ 匹配字符串的结尾 \W 匹配非字母或数字或下划线 \D 匹配非数字 \S 匹配非空白符 a|b 匹配字符 阅读全文
posted @ 2021-06-22 18:04 YuyuFishSmile 阅读(110) 评论(0) 推荐(0)
摘要: 通过爬取豆瓣的电影排行榜 import requests url = "https://movie.douban.com/j/chart/top_list" #params是get请求带参数 #data是post请求带参数 #重新进行封装参数 param = { "type":"24", "inte 阅读全文
posted @ 2021-06-22 16:08 YuyuFishSmile 阅读(419) 评论(0) 推荐(0)
摘要: 不是python自带的,需要安装pip install requests import requests url = 'https://cn.bing.com/search?q=%E8%B1%86%E7%93%A3' #请求网页url一般是get请求,这里用requests的get方法 res = 阅读全文
posted @ 2021-06-22 15:42 YuyuFishSmile 阅读(176) 评论(0) 推荐(0)
摘要: from urllib.request import urlopen #打开网址,得到一个响应,利用python自带的urlopen url = "http://www.baidu.com" resp = urlopen(url) result = resp.read() from urllib.r 阅读全文
posted @ 2021-06-22 09:33 YuyuFishSmile 阅读(168) 评论(0) 推荐(0)