spring_cache入门
Spring_Cache入门注解
注解
说明
@EnableCaching
开启缓存注解功能,通常加在启动类上
@Cacheable
在方法执行前先查询缓存中是否有数据,如果有数据,则直接返回缓存数据;如果缓存没有数据,调用方法并将返回值放入到缓存中
@CachePut
将方法的返回值放入到缓存中
@CacheEvict
将一条或多条数据从缓存中删除
案例123456789101112131415161718192021222324252627 @PostMapping // @CachePut(cacheNames = "userCache",key = "#result.id" ) 通过返回对象中的id作为key @CachePut(cacheNames = "userCache",key = "#user.id" )//redis的key值为userCache::user.id public User save(@RequestBody User user)& ...
微信小程序入门案例
微信小程序入门案例
httpClient
HttpClient入门案例依赖123456<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.6</version></dependency>
发送get请求1234567891011121314151617181920@Test public void testGet() throws Exception{// 创建httpClient对象 CloseableHttpClient aDefault = HttpClients.createDefault(); // 创建请求对象 HttpGet get = new HttpGet("https://api.qvqa.cn/cos");// 发送请求 Closea ...
数据可视化复习阶段
千峰Echarts+Vue3数据可视化
selenium快速入门
自动化两个例子12345678910111213141516171819202122232425262728293031323334from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.wait import WebDriverWaitfrom time import sleepbrowser = webdriver.Chrome()browser.get("http://www.baidu.com/")browser.implicitly_wait(10)print("当前源码:{}".format(browser.page_source))print("当前标题:{}".format(browser.title))print("当前链接地址:{}".format(browser.curren ...
爬取房地产信息lxml并且存入到mysql
爬取信息存入sql12345678910111213141516171819202122232425262728293031323334353637383940414243444546import requestsimport pymysqlfrom lxml import etreeheader ={ "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.36"}conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', password='root', database='ssss', charset='utf8', ...
爬取房地产信息lxml
使用lxml查询12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152from lxml import*from lxml import etreeimport requestsimport jsonimport reheader={ "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.36"}def getOnePage(url): try: res = requests.get(url, headers=header) if res.status_code == 200: return res.te ...
抓取壁纸图片正则表达式抓取
正则表达式抓取图片1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import reimport urllib.requestimport requestsimport osimport urllib.errorfrom bs4 import BeautifulSoupdef getHtmlText(url): res_date = requests.get(url=url) if res_date.status_code == requests.codes.OK: res_date.encoding = "utf-8" htmlText = res_date.text return htmlText else: print("请求状态异常......") return Noned ...
BeautifulSoup
使用BeautifulSoup查询元素1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import requestsfrom bs4 import BeautifulSoupimport jsonheader = { "User-Agent" :"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.36"}houses=[]for page in range(1,11): url =f"https://www.fangstar.com/rentls/pg{page}/" h = requests.get(url=url,headers=header ...
pyecharts快速入门
12345678910111213141516171819202122232425import pandas as pdfrom pyecharts.charts import Barfrom pyecharts import options as optsfile_path = './温度与降水量蒸发量.xlsx'data_frame = pd.read_excel(file_path)# x_data = list(data_frame['月份'])[0:5]# y_data =list(data_frame['蒸发量'])[0:5]show_x_data = []show_y_data = []for i in range(len(data_frame['温度'])): if data_frame['温度'][i] > 10 : show_y_data.append(data_frame['月份'][i]) show_x_ ...