python爬虫爬取中关村在线电脑以及参数数据

一. 内容简介

python爬虫爬取中关村在线电脑以及参数数据

二. 软件环境

2.1vsCode

2.2Anaconda

version: conda 22.9.0

三.主要流程

3.1 代码

解析都在代码里面

# 接口分析
# 原始接口,后面几个数字就是占位的,每个位置代表着不同的标签
# https://detail.zol.com.cn/notebook_index/subcate16_0_list_1_0_99_2_0_1.html
# https://detail.zol.com.cn/notebook_index/subcate16_0_list_1_0_99_2_0_3.html
# https://detail.zol.com.cn/notebook_index/subcate16_牌子_list_1_上市时间_99_排列方式_0_页码.html
# 联想 在中间加了160
# https://detail.zol.com.cn/notebook_index/subcate16_160_list_1_0_1_2_0_1.html
# 华为 在中间加了613
# https://detail.zol.com.cn/notebook_index/subcate16_613_list_1_0_1_2_0_1.html
# https://detail.zol.com.cn/notebook_index/subcate16_613_list_1_0_1_1_0_1.html
# 联想游戏本
# https://detail.zol.com.cn/notebook_index/subcate16_160_list_1_s1227_1_2_0_2.html
! pip install lxml
import urllib.request
from lxml import etree
import json
# 牌子,电脑类型,上市时间
def createRequext(brand,model,time,startPage):if brand == "华为":brand = "613"if brand == "联想":brand = "160"if brand == "惠普":brand = "223"if brand == "戴尔":brand = "21"if model == "游戏本":model = "s1227"if model == "商务本":model = "s1226"if time == "2022年下半年":time = "s10097-"if time == "2023年上半年":time = "s10098-"url = "https://detail.zol.com.cn/notebook_index/subcate16_" + brand +"_list_1_"+ time +  model +"_1_1_0_"+ str(startPage) +".html"# 调试使用print(url)headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'}request = urllib.request.Request(url=url,headers=headers)return request# 获取网页源码
def getContent(request):response = urllib.request.urlopen(request)# 中关村在线,编码格式采用GBK,返回头里面写了这个编码方式content = response.read().decode('GBK')# print(content)return content# 下载数据
def downLoad(content):tree = etree.HTML(content)# 注释的是读取多列样式的,没注释是按行读取的# # 获取名字,把括号后面的内容裁掉# nameList = tree.xpath("//ul[@id='J_PicMode']//a/img/@alt")# for index,name in enumerate(nameList):#     pos = nameList[index].find("(")#     if pos != -1: #         nameList[index] = nameList[index][0:pos]   #     pos = nameList[index].find("(")#     if pos != -1: #         nameList[index] = nameList[index][0:pos]      #     pos = nameList[index].find("/")#     if pos != -1: #         nameList[index] = nameList[index].replace('/', '_')#     # print(nameList[index])# # 获取图片链接,懒加载,# imgList = tree.xpath("//ul[@id='J_PicMode']//a/img")# for index,img in enumerate(imgList):#     # 拿到图片初始链接,并覆盖,原来并不能直接拿到.src属性#     imgList[index] = img.get('.src')#     # print(imgList[index])# 获取名字nameList = tree.xpath("//div[@class='list-box']//a//img/@alt")for index,name in enumerate(nameList):pos = nameList[index].find("(")if pos != -1: nameList[index] = nameList[index][0:pos]   pos = nameList[index].find("(")if pos != -1: nameList[index] = nameList[index][0:pos]      pos = nameList[index].find("/")if pos != -1: nameList[index] = nameList[index].replace('/', '_')print(nameList[index])# 获取图片链接,这个没有懒加载,imgList = tree.xpath("//div[@class='list-box']//a//img/@src")for index,img in enumerate(imgList):print(imgList[index])params = []# 获取详细参数paramList = tree.xpath("//div[@class='list-box']//a[@class='more']/@href")for index,param in enumerate(paramList):# https://detail.zol.com.cn/1397/1396968/param.shtmlparamList[index] = "https://detail.zol.com.cn" + param# print(index,paramList[index])param = laptopDetails(paramList[index])param["name"] = nameList[index]param["img"] = imgList[index]params.append(param)# # 下载# for i in range(len(nameList)):#     name = nameList[i]#     img = imgList[i]#     print(str(i) + ":::" + name +" "+ img)#     urllib.request.urlretrieve(url=img,filename="./img/"+name+".jpg")# 将列表数据转换为JSON格式字符串json_data = json.dumps(params, indent=4)  # indent参数可选,用于格式化输出# 将JSON数据写入文件with open("data.json", "a") as json_file:json_file.write(json_data)print("JSON数据已保存到文件")brand = "华为" # "华为" "联想" "惠普" "戴尔" 
model = "商务本" # "游戏本" "商务本"
time = "2022年下半年" # "2023年上半年" "2022年下半年"
with open("data.json", "w") as json_file:print("清空data数据")
startPage = 1
request = createRequext(brand,model,time,startPage)
content = getContent(request)
downLoad(content)
tree = etree.HTML(content)
num = tree.xpath("//span[@class='total']//b//text()")
endPage = int(int(num[0])/48) + 1
print(endPage)for page in range(startPage+1,endPage+1):# 请求对象定制request = createRequext(page)# 获取网页源码content = getContent(request)# 下载数据downLoad(content)# 下载完成print("下载完成!!!")
def laptopDetails(url):headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'}request = urllib.request.Request(url=url,headers=headers)response = urllib.request.urlopen(request)# 中关村在线,编码格式采用GBK,返回头里面写了这个编码方式content = response.read().decode('GBK')tree = etree.HTML(content)# 定义数据param = {# 处理器 cpu型号,核心数/线程数/频率"cpu":{ "model":"","frequency":"","thread":""},# 存储设备 内存类型,内润荣含量,硬盘容量ssd"memory":{"memorySize":"","memoryType":"","diskSize":"","diskType":"",},# 显示器 尺寸,分辨率,秘鲁"screen":{"size":"","ratio":"","refresh":"","detail":""},# 显卡 型号"gpu":{"model":""},# 接口"i_o":{"dataIo":"","videoIo":"","soundIo":"","otherIo":""}}# 读取cpu数据,第二张表num = tree.xpath("//table[2]//tr")for index in range(len(num)):left = tree.xpath("//table[2]//tr["+str(index+1)+"]//th//a/text()")if not left:# 当 left 为空时执行的操作left = tree.xpath("//table[2]//tr["+str(index+1)+"]//th//span/text()")right = tree.xpath("//table[2]//tr["+str(index+1)+"]//td//a/text()")if not right:# 当 right 为空时执行的操作right = tree.xpath("//table[2]//tr["+str(index+1)+"]//td//span/text()")# print(left,right)if index == 0:continueif left[0] == 'CPU型号':if right[0]:# 当 right[0] 不为空时执行的操作param["cpu"]["model"] = right[0]# print(param["cpu"]["model"])if left[0] == 'CPU主频':if right[0]:param["cpu"]["frequency"] = right[0]if left[0] == '最高睿频':if right[0]:param["cpu"]["frequency"] = param["cpu"]["frequency"] + "/" + right[0]if left[0] == '核心/线程数':if right[0]:   param["cpu"]["thread"] = right[0]# 读取memory数据,第三张表num = tree.xpath("//table[3]//tr")for index in range(len(num)):left = tree.xpath("//table[3]//tr["+str(index+1)+"]//th//a/text()")if not left:# 当 left 为空时执行的操作left = tree.xpath("//table[3]//tr["+str(index+1)+"]//th//span/text()")right = tree.xpath("//table[3]//tr["+str(index+1)+"]//td//a/text()")if not right:# 当 right 为空时执行的操作right = tree.xpath("//table[3]//tr["+str(index+1)+"]//td//span/text()")# print(left,right)if index == 0:continueif left[0] == '内存容量':if right[0]:param["memory"]["memorySize"] = right[0]# print(param["cpu"]["model"])if left[0] == '内存类型':if right[0]:param["memory"]["memoryType"] = right[0]if left[0] == '硬盘容量':if right[0]:param["memory"]["diskSize"] =  right[0]if left[0] == '硬盘描述':if right[0]:param["memory"]["diskType"] = right[0]# 读取screen数据,第四张表num = tree.xpath("//table[4]//tr")for index in range(len(num)):left = tree.xpath("//table[4]//tr["+str(index+1)+"]//th//a/text()")if not left:# 当 left 为空时执行的操作left = tree.xpath("//table[4]//tr["+str(index+1)+"]//th//span/text()")right = tree.xpath("//table[4]//tr["+str(index+1)+"]//td//a/text()")if not right:# 当 right 为空时执行的操作right = tree.xpath("//table[4]//tr["+str(index+1)+"]//td//span/text()")# print(left,right)if index == 0:continueif left[0] == '屏幕尺寸':param["screen"]["size"] = right[0]# print(param["cpu"]["model"])if left[0] == '屏幕分辨率':param["screen"]["ratio"] = right[0]if left[0] == '屏幕刷新率':param["screen"]["refresh"] =  right[0]if left[0] == '屏幕技术':param["screen"]["detail"] = right[0]# 读取gpu数据,第五张表num = tree.xpath("//table[5]//tr")for index in range(len(num)):left = tree.xpath("//table[5]//tr["+str(index+1)+"]//th//a/text()")if not left:# 当 left 为空时执行的操作left = tree.xpath("//table[5]//tr["+str(index+1)+"]//th//span/text()")right = tree.xpath("//table[5]//tr["+str(index+1)+"]//td//a/text()")if not right:# 当 right 为空时执行的操作right = tree.xpath("//table[5]//tr["+str(index+1)+"]//td//span/text()")# print(left,right)if index == 0:continueif left[0] == '显卡类型':if right[0]:param["gpu"]["model"] = right[0]# print(param["cpu"]["model"])# 读取i_o数据,第八张表num = tree.xpath("//table[8]//tr")for index in range(len(num)):left = tree.xpath("//table[8]//tr["+str(index+1)+"]//th//a/text()")if not left:# 当 left 为空时执行的操作left = tree.xpath("//table[8]//tr["+str(index+1)+"]//th//span/text()")right = tree.xpath("//table[8]//tr["+str(index+1)+"]//td//a/text()")if not right:# 当 right 为空时执行的操作right = tree.xpath("//table[8]//tr["+str(index+1)+"]//td//span/text()")# print(left,right)if index == 0:continueif left[0] == '数据接口':if right[0]:param["i_o"]["dataIo"] = right[0]# print(param["cpu"]["model"])if left[0] == '视频接口':if right[0]:param["i_o"]["videoIo"] = right[0]if left[0] == '音频接口':if right[0]:param["i_o"]["soundIo"] = right[0]if left[0] == '其他接口':if right[0]:param["i_o"]["otherIo"] = right[0]# print(param["cpu"])# print(param["memory"])# print(param["screen"])# print(param["gpu"])# print(param["i_o"])return param# laptopDetails("https://detail.zol.com.cn/1399/1398668/param.shtml")

3.2 结果展示

这是保存到数据,用json保存的

[{"cpu": {"model": "Intel \u9177\u777fi5 12500H","frequency": "2.5GHz/4.5GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR4X\uff08\u4f4e\u529f\u8017\u7248\uff09","diskSize": "512GB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1\uff0c\u83b1\u8335TUV\u65e0\u9891\u95ea\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a1\u00d7USB Type-C\uff0c1\u00d7Thunderbolt4","videoIo": "HDMI>","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook 14s 2022","img": "https://i0-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/00/03/ChMkK2NbjVqIcP9XAAALk4AEbQIAAJAUgAr3VsAAAur116.jpg"},{"cpu": {"model": "Intel \u9177\u777f i7 1260P","frequency": "2.1GHz/4.7GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR5\uff08\u4f4e\u529f\u8017\u7248\uff095200MHz>","diskSize": "1TB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "10.7\u4ebf\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a2\u00d7Thunderbolt4","videoIo": "","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook X Pro 2022 12\u4ee3\u9177\u777f\u7248","img": "https://i3-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/0B/09/ChMkLGLhSFOIRKdBAAALdLA0Z58AAFt-gOySAoAAAuM163.jpg"},{"cpu": {"model": "Intel \u9177\u777f i7 1260P","frequency": "2.1GHz/4.7GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR5\uff08\u4f4e\u529f\u8017\u7248\uff095200MHz>","diskSize": "512GB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "10.7\u4ebf\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a2\u00d7Thunderbolt4","videoIo": "","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook X Pro 2022 12\u4ee3\u9177\u777f\u7248","img": "https://i4-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/0B/09/ChMkK2LhSFOIPYUUAAALdLA0Z58AAFt-gOxCakAAAuM444.jpg"},{"cpu": {"model": "Intel \u9177\u777fi5 12500H","frequency": "2.5GHz/4.5GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR4X\uff08\u4f4e\u529f\u8017\u7248\uff09","diskSize": "1TB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1\uff0c\u83b1\u8335TUV\u65e0\u9891\u95ea\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a1\u00d7USB Type-C\uff0c1\u00d7Thunderbolt4","videoIo": "HDMI>","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook 14s 2022","img": "https://i3-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/00/03/ChMkLGNbjVqIa9TpAAALk4AEbQIAAJAUgAvYeAAAAur503.jpg"},{"cpu": {"model": "Intel \u9177\u777fi5 12450H","frequency": "2GHz/4.4GHz","thread": "\u516b\u6838\u5fc3/\u5341\u4e8c\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR4X\uff08\u4f4e\u529f\u8017\u7248\uff09","diskSize": "512GB>","diskType": ""},"screen": {"size": "16\u82f1\u5bf8","ratio": "1920x1200","refresh": "60Hz>","detail": "DC\u8c03\u5149\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a1\u00d7USB2.0\uff0c1\u00d7USB3.2","videoIo": "HDMI>","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook D 16 SE","img": "https://i4-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/03/03/ChMkLGNiH-qIP2kgAAANdGksIagAAJMHQP-tPgAAA2M174.jpg"},{"cpu": {"model": "Intel \u9177\u777fi7 12700H","frequency": "2.7GHz/4.7GHz","thread": "14\u6838\u5fc3/20\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR4X\uff08\u4f4e\u529f\u8017\u7248\uff09","diskSize": "1TB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1\uff0c\u83b1\u8335TUV\u65e0\u9891\u95ea\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a1\u00d7USB Type-C\uff0c1\u00d7Thunderbolt4","videoIo": "HDMI>","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook 14s 2022","img": "https://i0-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/00/03/ChMkK2NbjVuIWbqqAAALk4AEbQIAAJAUgAwiIsAAAur286.jpg"},{"cpu": {"model": "Intel \u9177\u777fi5 1240P","frequency": "1.7GHz/4.4GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR5\uff08\u4f4e\u529f\u8017\u7248\uff095200MHz>","diskSize": "512GB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "10.7\u4ebf\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a2\u00d7Thunderbolt4","videoIo": "","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook X Pro 2022 12\u4ee3\u9177\u777f\u7248","img": "https://i3-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/0B/09/ChMkK2LhSFOIA3P8AAALdLA0Z58AAFt-gOyL2oAAAuM369.jpg"},{"cpu": {"model": "Intel \u9177\u777f i7 1260P","frequency": "2.1GHz/4.7GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR5\uff08\u4f4e\u529f\u8017\u7248\uff095200MHz>","diskSize": "1TB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "10.7\u4ebf\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a2\u00d7Thunderbolt4","videoIo": "","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook X Pro 2022 \u5fae\u7ed2\u5178\u85cf\u7248","img": "https://i0-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/0B/09/ChMkLGLhSFWIACpsAAAL26BNorcAAFt-gO2DjYAAAvz796.jpg"},{"cpu": {"model": "Intel \u9177\u777f i7 1260P","frequency": "2.1GHz/4.7GHz","thread": "12\u6838\u5fc3/16\u7ebf\u7a0b"},"memory": {"memorySize": "16GB","memoryType": "LPDDR5\uff08\u4f4e\u529f\u8017\u7248\uff095200MHz>","diskSize": "512GB>","diskType": "SSD\u56fa\u6001\u786c\u76d8>"},"screen": {"size": "14.2\u82f1\u5bf8","ratio": "\u66f4\u591a\u8d85\u9ad8\u6e05\u5c4f\u7b14\u8bb0\u672c>","refresh": "90Hz","detail": "10.7\u4ebf\uff0c\u83b1\u8335TUV\u786c\u4ef6\u7ea7\u4f4e\u84dd\u5149\u8ba4\u8bc1"},"gpu": {"model": "\u96c6\u6210\u663e\u5361>"},"i_o": {"dataIo": "\u5de6\u4fa7\uff1a2\u00d7Thunderbolt4","videoIo": "","soundIo": "\u8033\u673a/\u9ea6\u514b\u98ce\u4e8c\u5408\u4e00\u63a5\u53e3","otherIo": ""},"name": "HUAWEI MateBook X Pro 2022 \u5fae\u7ed2\u5178\u85cf\u7248","img": "https://i0-prosmall-fd.zol-img.com.cn/t_s160x120/g7/M00/0B/09/ChMkK2LhSFSIcUniAAAL26BNorcAAFt-gO2AkMAAAvz046.jpg"}
]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/51458.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

07-Numpy基础-伪随机数生成

numpy.random模块对Python内置的random进行了补充,增加了一些用于高效生成多种概率分布的样本值的函数。 例如,你可以用normal来得到一个标准正态分布的44样本数组: 而Python内置的random模块则只能一次生成一个样本值。从下面的测试结果中可…

Mybatis查询一条数据

上一篇我们介绍了在pom文件中引入mybatis依赖,配置了mybatis配置文件,通过读取配置文件创建了会话工厂,使用会话工厂创建会话获取连接对象读取到了数据库的基本信息。 如果您需要对上面的内容进行了解,可以参考Mybatis引入与使用…

Python爬虫(十五)_案例:使用bs4的爬虫

本章将从Python案例讲起:所使用bs4做一个简单的爬虫案例,更多内容请参考:Python学习指南 案例:使用BeautifulSoup的爬虫 我们已腾讯社招页面来做演示:http://hr.tencent.com/position.php?&start10#a 使用BeautifulSoup4解析…

Elasticsearch中的数据完全备份至另外的Elasticsearch

有两种方式实现: 1、快照和还原 2、导出和导入 一、快照和还原 1、在源Elasticsearch集群上创建快照存储库 PUT _snapshot/my_backup {"type": "fs","settings": {"location": "/path/to/backup/directory"}…

【前端】vue3 接入antdv表单校验

1/🍕背景 1、表单校验是非常常见的需求,能够有效的拦截大部分的错误数据,提升效率。 2、快速的给使用者提示和反馈,用户体验感非常好。 3、成熟的表单校验框架,开发效率高,bug少。 最近使用的是vue3antdv的…

[MyBatis系列④]核心配置文件

目录 1、简介 2、DTD 3、typeHandlers 3.1、默认类型处理器 3.2、自定义类型处理器 4、plugins ⭐MyBatis系列①:增删改查 ⭐MyBatis系列②:两种Dao开发方式 ⭐MyBatis系列③:动态SQL 1、简介 MyBatis的核心配置文件(通常命…

基于IDEA使用maven创建hibernate项目

1、创建maven项目 2、导入hibernate需要的jar包 <!--hibernate核心依赖--><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>5.4.1.Final</version></dependency><!--…

基于亚马逊云科技服务,构建大语言模型问答知识库

随着大语言模型效果明显提升&#xff0c;其相关的应用不断涌现呈现出越来越火爆的趋势。其中一种比较被广泛关注的技术路线是大语言模型&#xff08;LLM&#xff09;知识召回&#xff08;Knowledge Retrieval&#xff09;的方式&#xff0c;在私域知识问答方面可以很好的弥补通…

【Git】git clone --depth 1 浅克隆

问题 PycharmProjects git clone git Cloning into risk-package... remote: Counting objects: 576, done. error: pack-objects died of signal 947/574) error: git upload-pack: git-pack-objects died with error. fatal: git upload-pack: aborting due to possible r…

ARM64函数调用流程分析

ARM64函数调用流程分析 1 ARM64 函数调用实例2 对应代码的分析2.1 main函数及其对应的汇编程序2.1.1 main的C代码实现2.1.2 main函数对应汇编及其分析2.1.3 执行完成之后栈的存放情况 2.2 test_fun_a函数及其对应的汇编程序2.2.1 test_fun_a函数的C实现2.2.2 test_fun_a函数对应…

Oracle的学习心得和知识总结(二十八)|Oracle数据库数据库回放功能之论文二翻译及学习

目录结构 注&#xff1a;提前言明 本文借鉴了以下博主、书籍或网站的内容&#xff0c;其列表如下&#xff1a; 1、参考书籍&#xff1a;《Oracle Database SQL Language Reference》 2、参考书籍&#xff1a;《PostgreSQL中文手册》 3、EDB Postgres Advanced Server User Gui…

MAC电脑外放没有声音解决方案

烦人呐&#xff0c;我的mac外接显示屏幕&#xff0c;显示器没有音频输出&#xff0c;需要mac笔记本的音频输出&#xff0c;但是经常打开后&#xff0c;mac没有声音输出&#xff0c;需要重启电脑才能生效。亲测一下方法有效&#xff0c;请参考&#xff1a; 文章目录 一、短期方案…

基于mha+mycat2+gtid的半同步主从复制双vip高可用MySQL集群

目录 项目名称 项目架构图 项目概述 项目准备 项目步骤 一、使用ansible编写palybook实现4台二进制安装MySQL环境的部署&#xff0c;并把master上的基础数据下发到所有slave服务器上 1. 建立免密通道 2.安装ansible在ansible服务器上&#xff0c;并写好主机清单 3.将…

汽车电子笔记之:AUTOSA架构下的OS概述

目录 1、实时操作系统&#xff08;RTOS&#xff09; 2、OSEK操作系统 2.1、OSEK概述 2.2、OSEK处理等级 2.3、OSEK任务符合类 2.4、OSEK优先级天花板模式 3、AUTOSAR OS 3.1、 AUTOSAR OS对OSEK OS的继承和扩展 3.2、AUTOSAR OS的调度表 3.3、AUTOSAR OS的时间保护 3…

冷冻冷藏自动化立体库|HEGERLS四向穿梭车助力打造冷链智能仓储新力量

随着中国仓储物流整体规模和低温产品消费需求的稳步增长&#xff0c;冷链市场应用潜力不断释放。而在实际运行中&#xff0c;由于冷库容量不足、基础设施落后、管理机制欠缺等原因&#xff0c;经常出现“断链”现象&#xff0c;严重威胁到产品质量和消费者安全。 河北沃克金属…

尚硅谷大数据项目《在线教育之离线数仓》笔记004

视频地址&#xff1a;尚硅谷大数据项目《在线教育之离线数仓》_哔哩哔哩_bilibili 目录 第9章 数仓开发之DWD层 P049 P050 P051 P052 P053 P054 P055 P056 P057 P058 P059 P060 P061 P062 P063 P064 P065 P066 P067 P068 P069 P070 第9章 数仓开发之DWD…

Wlan——锐捷零漫游网络解决方案以及相关配置

目录 零漫游介绍 一代零漫游 二代单频率零漫游 二代双频率零漫游 锐捷零漫游方案总结 锐捷零漫游方案的配置 配置无线信号的信道 开启关闭5G零漫游 查看配置 零漫游介绍 普通的漫游和零漫游的区别 普通漫游 漫游是由一个AP到另一个AP或者一个射频卡到另一个射频卡的漫…

软考高级系统架构设计师系列论文九十八:论软件开发平台的选择与应用

软考高级系统架构设计师系列论文九十八:论软件开发平台的选择与应用 一、相关知识点二、摘要三、正文四、总结一、相关知识点 软考高级系统架构设计师系列之:面向构件的软件设计,构件平台与典型架构二、摘要 本文讨论选择新软件开发平台用于重新开发银行中间业务系统。银行中…

深入理解 Vue Router:构建可靠的前端路由系统

目录 01-什么是前端路由以及路由两种模式实现原理02-路由的基本搭建与嵌套路由模式03-动态路由模式与编程式路由模式04-命名路由与命名视图与路由元信息05-路由传递参数的多种方式及应用场景06-详解route对象与router对象07-路由守卫详解及应用场景 01-什么是前端路由以及路由两…

机器学习之SGD(Stochastic Gradient Descent,随机梯度下降)

SGD&#xff08;Stochastic Gradient Descent&#xff0c;随机梯度下降&#xff09;是深度学习中最基本的优化算法之一。它是一种迭代式的优化方法&#xff0c;用于训练神经网络和其他机器学习模型。以下是关于SGD优化器的重要信息&#xff1a; 基本原理&#xff1a;SGD的基本思…