当前位置: 首页 > news >正文

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"}
]

相关文章:

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

一. 内容简介 python爬虫爬取中关村在线电脑以及参数数据 二. 软件环境 2.1vsCode 2.2Anaconda version: conda 22.9.0 三.主要流程 3.1 代码 解析都在代码里面 # 接口分析 # 原始接口,后面几个数字就是占位的,每个位置代表着不同的标签 # http…...

chatGPT-对话爱因斯坦

引言 阿尔伯特爱因斯坦( 1879年 3 月 14 日 – 1955 年 4 月 18 日)是一位出生于德国的理论物理学家,被广泛认为成为有史以来最伟大、最有影响力的科学家之一。他以发展相对论而闻名,他还对量子力学做出了重要贡献,因…...

嵌入式软件开发中的数据类型转换

在嵌入式软件开发时,数据的显示必不可少,那么必定会涉及到数据类型转换。将不同类型的数据在编程中进行转换,以便满足不同的需求。 插入一个知识点: 在C语言中,字符串是由字符组成的字符数组,以null终止符…...

The Go Blog 01:反射的法则(译文)

反思的法则 罗伯-派克 2011 年 9 月 6 日 引言 计算机中的反射是指程序检查自身结构的能力,尤其是通过类型检查自身结构的能力;它是元编程的一种形式。它也是造成混乱的一个重要原因。 在本文中,我们试图通过解释 Go 中的反射是如何工作的…...

Visual Studio Code前端开发插件推荐

引言 Visual Studio Code(简称VS Code)是一款轻量级且强大的开源代码编辑器,广受前端开发者的喜爱。其丰富的插件生态系统为前端开发提供了许多便利和增强功能的插件。本篇博客将向大家推荐一些在前端开发中常用且优秀的插件,并提…...

jps(JVM Process Status Tool):虚拟机进程状况工具

jps(JVM Process Status Tool):虚拟机进程状况工具 列出正在运行的虚拟机进程,并显示虚拟机执行主类名称(Main Class,main()函数所在的类)以及这些进程的本地虚拟机唯一ID(LVMID&am…...

初阶c语言:实战项目三子棋

前言 大家已经和博主学习有一段时间了,今天讲一个有趣的实战项目——三子棋 目录 前言 制作菜单 构建游戏选择框架 实现游戏功能 模块化编程 初始化棋盘 打印棋盘 玩家下棋 电脑下棋 时间戳:推荐一篇 C语言生成随机数的方法_c语言随机数_杯浅…...

计网第三章(数据链路层)(三)

一、点对点协议PPP 在第一篇里有提到数据链路层的信道分为两种:点对点信道和广播信道。 PPP协议就属于点对点信道上的协议。 如果对前面数据链路层的三个基本问题了解的比较透彻,那么这一块很多东西都很好理解。 从考试的角度来讲,PPP协议…...

蓝桥杯每日N题 (砝码称重)

大家好 我是寸铁 希望这篇题解对你有用,麻烦动动手指点个赞或关注,感谢您的关注 不清楚蓝桥杯考什么的点点下方👇 考点秘籍 想背纯享模版的伙伴们点点下方👇 蓝桥杯省一你一定不能错过的模板大全(第一期) 蓝桥杯省一你一定不…...

Opencv 视频的读取与写入

目录 前言 通过路径获取视频内容 获取视频内容 检查是否正确打开 循环播放 完整代码 从摄像头读取视频数据 获取视频设备 其他与直接读取视频一致 完整实例 录制视频 用于创建视频编解码器的四字符码(FourCC) cv2.VideoWriter() 将视频帧…...

LeetCode 833. Find And Replace in String【字符串,哈希表,模拟】1460

本文属于「征服LeetCode」系列文章之一,这一系列正式开始于2021/08/12。由于LeetCode上部分题目有锁,本系列将至少持续到刷完所有无锁题之日为止;由于LeetCode还在不断地创建新题,本系列的终止日期可能是永远。在这一系列刷题文章…...

Cesium轨迹漫游及视角切换

飞行漫游,就是让Camera飞行。Camera有一些方法可以实现位置、视角的调整,比如flyTo,setView方法。但这些方法并不能沿着我们想要的路径调整,在通过插值的方法不停的调用setView,但这样会造成视图卡顿,而且计…...

构建去中心化微服务集群,满足高可用性和高并发需求的实践指南!

随着互联网技术的不断发展,微服务架构已经成为了开发和部署应用程序的一种主流方式。然而,当应用程序需要满足高可用性和高并发需求时,单一中心化的微服务架构可能无法满足性能和可靠性的要求。因此,构建一个去中心化的微服务集群…...

开集输出和开漏输出

​​​​​​ 首先指明一下以下8中GPIO输入输出模式: GPIO_Mode_AIN 模拟输入; GPIO_Mode_IN_FLOATING 浮空输入; GPIO_Mode_IPD 下拉输入; GPIO_Mode…...

解决内网GitLab 社区版 15.11.13项目拉取失败

问题描述 GitLab 社区版 发布不久,搭建在内网拉取项目报错,可能提示 unable to access https://github.comxxxxxxxxxxx: Failed to connect to xxxxxxxxxxxxxGit clone error - Invalid argument error:14077438:SSL routines:SSL23_GET_S 15.11.13ht…...

【MySQL--->表的约束】

文章目录 [TOC](文章目录) 一、表的约束概念二、空属性约束三、default约束四、zerofill约束五、主键约束六、auto_increment(自增长)约束七、唯一键约束八、外键约束 一、表的约束概念 表通过约束可以保证插入数据的合法性,本质是通过技术手段,保证插入数据收约束,保证数据的…...

github中Keyless Google Maps API在网页中显示地图和标记 无需api key

使用Google Maps API在网页中显示地图和标记的示例博客。以下是一个简单的示例: C:\pythoncode\blog\google-map-markers-gh-pages\google-map-markers-gh-pages\index.html 介绍: 在本篇博客中,我们将学习如何使用Google Maps API在网页中…...

ComPDFKit PDF SDK for Windows Crack

ComPDFKit PDF SDK for Windows Crack 添加了在创建文本框时调整默认属性的支持。 增加了对调整PDF大小时调整宽度的支持。 添加了对编辑文本时更多快捷方式的支持。 优化了文本输入,并将字体样式与原始文本相匹配。 在内容编辑器模式下复制和粘贴时优化了UI交互。 …...

React+Typescript 状态管理

好 本文 我们来说说状态管理 也就是我们的 state 我们直接顺便写一个组件 参考代码如下 import * as React from "react";interface IProps {title: string,age: number }interface IState {count:number }export default class hello extends React.Component<I…...

stable diffusion 运行时报错: returned non-zero exit status 1.

运行sh run.sh安装stable diffusion时报错&#xff1a;ImportError: cannot import name builder from google.protobuf.internal (stable-diffusion-webui/venv/lib/python3.8/site-packages/google/protobuf/internal/__init__.py) 原因&#xff1a;python版本过低&#xff0…...

FFmpeg 低延迟同屏方案

引言 在实时互动需求激增的当下&#xff0c;无论是在线教育中的师生同屏演示、远程办公的屏幕共享协作&#xff0c;还是游戏直播的画面实时传输&#xff0c;低延迟同屏已成为保障用户体验的核心指标。FFmpeg 作为一款功能强大的多媒体框架&#xff0c;凭借其灵活的编解码、数据…...

汽车生产虚拟实训中的技能提升与生产优化​

在制造业蓬勃发展的大背景下&#xff0c;虚拟教学实训宛如一颗璀璨的新星&#xff0c;正发挥着不可或缺且日益凸显的关键作用&#xff0c;源源不断地为企业的稳健前行与创新发展注入磅礴强大的动力。就以汽车制造企业这一极具代表性的行业主体为例&#xff0c;汽车生产线上各类…...

3403. 从盒子中找出字典序最大的字符串 I

3403. 从盒子中找出字典序最大的字符串 I 题目链接&#xff1a;3403. 从盒子中找出字典序最大的字符串 I 代码如下&#xff1a; class Solution { public:string answerString(string word, int numFriends) {if (numFriends 1) {return word;}string res;for (int i 0;i &…...

ios苹果系统,js 滑动屏幕、锚定无效

现象&#xff1a;window.addEventListener监听touch无效&#xff0c;划不动屏幕&#xff0c;但是代码逻辑都有执行到。 scrollIntoView也无效。 原因&#xff1a;这是因为 iOS 的触摸事件处理机制和 touch-action: none 的设置有关。ios有太多得交互动作&#xff0c;从而会影响…...

C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。

1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj&#xff0c;再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...

华硕a豆14 Air香氛版,美学与科技的馨香融合

在快节奏的现代生活中&#xff0c;我们渴望一个能激发创想、愉悦感官的工作与生活伙伴&#xff0c;它不仅是冰冷的科技工具&#xff0c;更能触动我们内心深处的细腻情感。正是在这样的期许下&#xff0c;华硕a豆14 Air香氛版翩然而至&#xff0c;它以一种前所未有的方式&#x…...

初探Service服务发现机制

1.Service简介 Service是将运行在一组Pod上的应用程序发布为网络服务的抽象方法。 主要功能&#xff1a;服务发现和负载均衡。 Service类型的包括ClusterIP类型、NodePort类型、LoadBalancer类型、ExternalName类型 2.Endpoints简介 Endpoints是一种Kubernetes资源&#xf…...

Qemu arm操作系统开发环境

使用qemu虚拟arm硬件比较合适。 步骤如下&#xff1a; 安装qemu apt install qemu-system安装aarch64-none-elf-gcc 需要手动下载&#xff0c;下载地址&#xff1a;https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x…...

c++第七天 继承与派生2

这一篇文章主要内容是 派生类构造函数与析构函数 在派生类中重写基类成员 以及多继承 第一部分&#xff1a;派生类构造函数与析构函数 当创建一个派生类对象时&#xff0c;基类成员是如何初始化的&#xff1f; 1.当派生类对象创建的时候&#xff0c;基类成员的初始化顺序 …...

Ubuntu系统复制(U盘-电脑硬盘)

所需环境 电脑自带硬盘&#xff1a;1块 (1T) U盘1&#xff1a;Ubuntu系统引导盘&#xff08;用于“U盘2”复制到“电脑自带硬盘”&#xff09; U盘2&#xff1a;Ubuntu系统盘&#xff08;1T&#xff0c;用于被复制&#xff09; &#xff01;&#xff01;&#xff01;建议“电脑…...