正则(re.findall) 抓取script中的数据

2024-02-23 17:50

本文主要是介绍正则(re.findall) 抓取script中的数据,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

以某网站为例(政府性质),路由地址就不发了

1、网站数据如下

在这里插入图片描述
数据是动态加载,无法使用xpath标签解析

在这里插入图片描述

2、re.findall()抓取
import re
import json
import requests# 获取详情页
def spider_test(pageid):url = "http://xxxxxxxxxxxxx/view?id=%s" % pageidheaders = {'Cookie': 'HttpOnly; JSESSIONID=F24B4AB94E907005C1D88A8E6991EBCE'}response = requests.request("GET", url, headers=headers, data={}).text# enterprise :ko.mapping.fromJS 定位到方法# \(\) 转义 以"("开始匹配,")"结束 .*?非贪婪匹配 精准抓取目标数据# re.S 忽略换行符(\n) 抓取范围内的所有字符content = re.findall(r'enterprise :ko.mapping.fromJS\((.*?)\),', response, re.S)print("content:", content)content = json.loads(content[0])print("content:", content)print(content.get("fcEntname"))if __name__ == '__main__':spider_test("2c9297bd7bd453c5017bde00066d08c7")#content: ['{\n  "id" : "2c9297bd7bd453c5017bde00066d08c7",\n  "fcEntcode" : "GGZY20489",\n  "fcEntname" : "东莞市黄江镇胜前岗股份经济联合社",\n  "fcArtname" : "叶亮华",\n  "fnArtpapertype" : "1",\n  "fcArtpapersn" : "441900198101074710",\n  "fcCountry" : null,\n  "fcBelongareasn" : "441900",\n  "fcBelongareasnName" : "东莞市",\n  "fcEntpropertysn" : null,\n  "fcIndustrysn" : null,\n  "fcBusinesslicenseno" : "N2441900725475951U",\n  "fcRegistrationno" : "441900725457951",\n  "fdBuilddate" : "2004-09-20",\n  "fdBusinessauthority" : "东莞市农业农村局",\n  "fdVaildenddate" : "2029-09-24",\n  "fcCreditgrade" : null,\n  "fmEnrolfund" : 0,\n  "fcCurrencysn" : null,\n  "fcEnrolbaseunit" : null,\n  "fcEntinfodeclareperson" : "黎小姐",\n  "fdEntinfodeclaredate" : null,\n  "fcEntinfodeclarepersontel" : "13712881148",\n  "fcEntlinktel" : "0769-83361231",\n  "fcCaid" : null,\n  "fcEntlinkaddr" : "广东省东莞市黄江镇田美北社区胜前岗村江北路胜前岗花园七街6号201",\n  "fcEntlinkzipcode" : "                  ",\n  "fcEntlinkemail" : "275160992@qq.com",\n  "fcRoletypesn" : null,\n  "fnEntstatus" : "1",\n  "fcFlowstatus" : "3",\n  "fcAccount" : "2c9297bd7bd453c5017bde00066d08c5",\n  "fdCreatetime" : "2021-09-13 15:12:28",\n  "fcCreator" : "yelianghua123",\n  "fdModifytime" : "2021-09-13 16:22:59",\n  "fcModifier" : "yelianghua123",\n  "fcOrganizationcode" : "N2441900725475951U",\n  "fcOrganizationauthority" : "东莞市农业农村局",\n  "fdSafelicencesdate" : "2019-09-25",\n  "fdSafelicenceedate" : "2029-09-24",\n  "fcSafelicencenumber" : "N2441900725475951U",\n  "fcSafelicencecert" : "东莞市农业农村局",\n  "fcOrganizingauthority" : null,\n  "fcOrganizingcode" : null,\n  "fcBusinesstype" : null,\n  "fcSubjectrole" : null,\n  "fcRegistrationdept" : null,\n  "fcRentregistrationno" : null,\n  "fcRentregistrationdept" : null,\n  "fcSocialno" : null,\n  "fcSocialdept" : null,\n  "fcOrganizationintro" : null,\n  "fnIsotherprovinces" : "0",\n  "fcIntogdadress" : null,\n  "fdEffectivedate" : "2021-09-15 09:06:47",\n  "fcResponsibleofficer" : null,\n  "fcIndustrycode" : null,\n  "fdAudittime" : "2021-09-15 09:06:47",\n  "fcAuditperson" : "詹航锋",\n  "fnIsswotherprovinces" : "0",\n  "fcSwintogdadress" : null,\n  "fnIsjtotherprovinces" : "0",\n  "fcJtintogdadress" : null,\n  "fcBelongtrade" : null\n}']
#content: {'id': '2c9297bd7bd453c5017bde00066d08c7', 'fcEntcode': 'GGZY20489', 'fcEntname': '东莞市黄江镇胜前岗股份经济联合社', 'fcArtname': '叶亮华', 'fnArtpapertype': '1', 'fcArtpapersn': '441900198101074710', 'fcCountry': None, 'fcBelongareasn': '441900', 'fcBelongareasnName': '东莞市', 'fcEntpropertysn': None, 'fcIndustrysn': None, 'fcBusinesslicenseno': 'N2441900725475951U', 'fcRegistrationno': '441900725457951', 'fdBuilddate': '2004-09-20', 'fdBusinessauthority': '东莞市农业农村局', 'fdVaildenddate': '2029-09-24', 'fcCreditgrade': None, 'fmEnrolfund': 0, 'fcCurrencysn': None, 'fcEnrolbaseunit': None, 'fcEntinfodeclareperson': '黎小姐', 'fdEntinfodeclaredate': None, 'fcEntinfodeclarepersontel': '13712881148', 'fcEntlinktel': '0769-83361231', 'fcCaid': None, 'fcEntlinkaddr': '广东省东莞市黄江镇田美北社区胜前岗村江北路胜前岗花园七街6号201', 'fcEntlinkzipcode': '                  ', 'fcEntlinkemail': '275160992@qq.com', 'fcRoletypesn': None, 'fnEntstatus': '1', 'fcFlowstatus': '3', 'fcAccount': '2c9297bd7bd453c5017bde00066d08c5', 'fdCreatetime': '2021-09-13 15:12:28', 'fcCreator': 'yelianghua123', 'fdModifytime': '2021-09-13 16:22:59', 'fcModifier': 'yelianghua123', 'fcOrganizationcode': 'N2441900725475951U', 'fcOrganizationauthority': '东莞市农业农村局', 'fdSafelicencesdate': '2019-09-25', 'fdSafelicenceedate': '2029-09-24', 'fcSafelicencenumber': 'N2441900725475951U', 'fcSafelicencecert': '东莞市农业农村局', 'fcOrganizingauthority': None, 'fcOrganizingcode': None, 'fcBusinesstype': None, 'fcSubjectrole': None, 'fcRegistrationdept': None, 'fcRentregistrationno': None, 'fcRentregistrationdept': None, 'fcSocialno': None, 'fcSocialdept': None, 'fcOrganizationintro': None, 'fnIsotherprovinces': '0', 'fcIntogdadress': None, 'fdEffectivedate': '2021-09-15 09:06:47', 'fcResponsibleofficer': None, 'fcIndustrycode': None, 'fdAudittime': '2021-09-15 09:06:47', 'fcAuditperson': '詹航锋', 'fnIsswotherprovinces': '0', 'fcSwintogdadress': None, 'fnIsjtotherprovinces': '0', 'fcJtintogdadress': None, 'fcBelongtrade': None}
#东莞市黄江镇胜前岗股份经济联合社

很方便的就拿到了想要的数据,效果非常赞,但实际抓取时遇到了以下问题
在这里插入图片描述
检查该详情页数据:
在这里插入图片描述
修改代码如下

# 修改匹配规则为以"({" 开始 "})"结束
content = re.findall(r'enterprise :ko.mapping.fromJS\({(.*?)}\),', response, re.S)
print("content:", content)
# content: ['\n  "id" : "2c9296bf597d9c4e0159865158763732",\n  "fcEntcode" : "GGZY02494",\n  "fcEntname" : "广州市水务科学研究所",\n  "fcArtname" : "李志威",\n  "fnArtpapertype" : "1",\n  "fcArtpapersn" : "420106196911205058",\n  "fcCountry" : null,\n  "fcBelongareasn" : "440100",\n  "fcBelongareasnName" : "广州市",\n  "fcEntpropertysn" : "110",\n  "fcIndustrysn" : null,\n  "fcBusinesslicenseno" : "124401004553512027",\n  "fcRegistrationno" : null,\n  "fdBuilddate" : "1978-04-29",\n  "fdBusinessauthority" : "广州市事业单位登记管理局",\n  "fdVaildenddate" : "2020-02-15",\n  "fcCreditgrade" : null,\n  "fmEnrolfund" : 1316,\n  "fcCurrencysn" : null,\n  "fcEnrolbaseunit" : null,\n  "fcEntinfodeclareperson" : "李敏华",\n  "fdEntinfodeclaredate" : null,\n  "fcEntinfodeclarepersontel" : "13580421982",\n  "fcEntlinktel" : "020-34289067",\n  "fcCaid" : null,\n  "fcEntlinkaddr" : "广州市海珠区前进路基立下道北12号",\n  "fcEntlinkzipcode" : "                  ",\n  "fcEntlinkemail" : "sks2000@vip.com",\n  "fcRoletypesn" : null,\n  "fnEntstatus" : "1",\n  "fcFlowstatus" : "3",\n  "fcAccount" : "2c9296bf597d9c4e015986515875372e",\n  "fdCreatetime" : "2017-01-10 10:59:55",\n  "fcCreator" : "gzsswkxyjs",\n  "fdModifytime" : "2017-01-12 16:45:41",\n  "fcModifier" : "gzsswkxyjs",\n  "fcOrganizationcode" : "124401004553512027",\n  "fcOrganizationauthority" : "中华人民共和国国家质量监督检验检疫总局",\n  "fdSafelicencesdate" : null,\n  "fdSafelicenceedate" : null,\n  "fcSafelicencenumber" : null,\n  "fcSafelicencecert" : null,\n  "fcOrganizingauthority" : null,\n  "fcOrganizingcode" : null,\n  "fcBusinesstype" : null,\n  "fcSubjectrole" : null,\n  "fcRegistrationdept" : null,\n  "fcRentregistrationno" : null,\n  "fcRentregistrationdept" : null,\n  "fcSocialno" : null,\n  "fcSocialdept" : null,\n  "fcOrganizationintro" : "<span style=\\"color:#000000;background-color:#F7FBFD;\\">广州市水务科学研究所(原广州市水利科学研究所,下称“水科所”)成立于1978年,是广州市水务局直属的事业单位,也是广州市水务系统唯一的科研机构。主要职能是:承担广州市水务科学研究、成果转化、科技咨询和科技推广与服务,推动水务行业科技进步。水科所建所以来一直致力于水务科研与新技术推得省、市科技进步奖二十多项,2009年度有3项产品获得广州市自主创新产品证书,有多项软广应用,为行业发展提供了有力的技术与支撑,先后获件获得中华人民共和国国家版权局颁发的计算机软件著作权登记证书上。1994年通过广东省技术监督局计量认证(CMA),2004年通过中国实验室认可委员会认可(CNAL),2009年通过中国国家合格评定委员会认可(CNAS), 是广东省水利行业首家通过CNAS实验室认可的检测单位,。 广州市水务科学研究所,即为广州市水务工程质量检测站,拥有一批国内领先的仪器设备和技术堪赞的资深专家及专业队伍,具备大型水利工程、市政供排水及其它建筑工程质量检测能力。始终以“公正、规范、准确、客观”为方针,以“一流技术、优质服务”为宗旨承接混凝土工程、岩土工程、地基与基础工程、金属结构、管材、量测、水量平衡等检测以及科研、咨询业务。承担广州市(含从化市、增城市)水务工程建设工程质量监督检测业务,承担广州市(含从化市、增城市)水务工程平行、对比、第三方检测业务,为水务建设提供真实、可靠的数据,取得良好的成效。 我单位具有水利工程质量检测混凝土工程、岩土工程、量测和金属结构甲级资质。水文、水资源调查评价乙级资质、测绘丙级资质、水土保持方案编制乙级资质、安防资质、水平衡测试资质。</span>",\n  "fnIsotherprovinces" : "0",\n  "fcIntogdadress" : null,\n  "fdEffectivedate" : "2017-01-13 16:57:30",\n  "fcResponsibleofficer" : null,\n  "fcIndustrycode" : null,\n  "fdAudittime" : "2017-01-13 16:57:30",\n  "fcAuditperson" : "蔡惠芬",\n  "fnIsswotherprovinces" : "1",\n  "fcSwintogdadress" : "http://gcjs.gdwater.gov.cn/article.html?type=xy&menu_first=信用信息公开&menu_second=从业单位信用信息&menu_third=企业基本信息&id=3070&tableName=Bm211xydwQyjb&name=广州市水务科学研究所(质量检测)",\n  "fnIsjtotherprovinces" : "0",\n  "fcJtintogdadress" : null,\n  "fcBelongtrade" : null\n']
# 现数据为列表,构造数据为json格式
content = str("{" + content[0] + "}")
print("content:", content)
# content: '{\n  "id" : "2c9296bf597d9c4e0159865158763732",\n  "fcEntcode" : "GGZY02494",\n  "fcEntname" : "广州市水务科学研究所",\n  "fcArtname" : "李志威",\n  "fnArtpapertype" : "1",\n  "fcArtpapersn" : "420106196911205058",\n  "fcCountry" : null,\n  "fcBelongareasn" : "440100",\n  "fcBelongareasnName" : "广州市",\n  "fcEntpropertysn" : "110",\n  "fcIndustrysn" : null,\n  "fcBusinesslicenseno" : "124401004553512027",\n  "fcRegistrationno" : null,\n  "fdBuilddate" : "1978-04-29",\n  "fdBusinessauthority" : "广州市事业单位登记管理局",\n  "fdVaildenddate" : "2020-02-15",\n  "fcCreditgrade" : null,\n  "fmEnrolfund" : 1316,\n  "fcCurrencysn" : null,\n  "fcEnrolbaseunit" : null,\n  "fcEntinfodeclareperson" : "李敏华",\n  "fdEntinfodeclaredate" : null,\n  "fcEntinfodeclarepersontel" : "13580421982",\n  "fcEntlinktel" : "020-34289067",\n  "fcCaid" : null,\n  "fcEntlinkaddr" : "广州市海珠区前进路基立下道北12号",\n  "fcEntlinkzipcode" : "                  ",\n  "fcEntlinkemail" : "sks2000@vip.com",\n  "fcRoletypesn" : null,\n  "fnEntstatus" : "1",\n  "fcFlowstatus" : "3",\n  "fcAccount" : "2c9296bf597d9c4e015986515875372e",\n  "fdCreatetime" : "2017-01-10 10:59:55",\n  "fcCreator" : "gzsswkxyjs",\n  "fdModifytime" : "2017-01-12 16:45:41",\n  "fcModifier" : "gzsswkxyjs",\n  "fcOrganizationcode" : "124401004553512027",\n  "fcOrganizationauthority" : "中华人民共和国国家质量监督检验检疫总局",\n  "fdSafelicencesdate" : null,\n  "fdSafelicenceedate" : null,\n  "fcSafelicencenumber" : null,\n  "fcSafelicencecert" : null,\n  "fcOrganizingauthority" : null,\n  "fcOrganizingcode" : null,\n  "fcBusinesstype" : null,\n  "fcSubjectrole" : null,\n  "fcRegistrationdept" : null,\n  "fcRentregistrationno" : null,\n  "fcRentregistrationdept" : null,\n  "fcSocialno" : null,\n  "fcSocialdept" : null,\n  "fcOrganizationintro" : "<span style=\\"color:#000000;background-color:#F7FBFD;\\">广州市水务科学研究所(原广州市水利科学研究所,下称“水科所”)成立于1978年,是广州市水务局直属的事业单位,也是广州市水务系统唯一的科研机构。主要职能是:承担广州市水务科学研究、成果转化、科技咨询和科技推广与服务,推动水务行业科技进步。水科所建所以来一直致力于水务科研与新技术推得省、市科技进步奖二十多项,2009年度有3项产品获得广州市自主创新产品证书,有多项软广应用,为行业发展提供了有力的技术与支撑,先后获件获得中华人民共和国国家版权局颁发的计算机软件著作权登记证书上。1994年通过广东省技术监督局计量认证(CMA),2004年通过中国实验室认可委员会认可(CNAL),2009年通过中国国家合格评定委员会认可(CNAS), 是广东省水利行业首家通过CNAS实验室认可的检测单位,。 广州市水务科学研究所,即为广州市水务工程质量检测站,拥有一批国内领先的仪器设备和技术堪赞的资深专家及专业队伍,具备大型水利工程、市政供排水及其它建筑工程质量检测能力。始终以“公正、规范、准确、客观”为方针,以“一流技术、优质服务”为宗旨承接混凝土工程、岩土工程、地基与基础工程、金属结构、管材、量测、水量平衡等检测以及科研、咨询业务。承担广州市(含从化市、增城市)水务工程建设工程质量监督检测业务,承担广州市(含从化市、增城市)水务工程平行、对比、第三方检测业务,为水务建设提供真实、可靠的数据,取得良好的成效。 我单位具有水利工程质量检测混凝土工程、岩土工程、量测和金属结构甲级资质。水文、水资源调查评价乙级资质、测绘丙级资质、水土保持方案编制乙级资质、安防资质、水平衡测试资质。</span>",\n  "fnIsotherprovinces" : "0",\n  "fcIntogdadress" : null,\n  "fdEffectivedate" : "2017-01-13 16:57:30",\n  "fcResponsibleofficer" : null,\n  "fcIndustrycode" : null,\n  "fdAudittime" : "2017-01-13 16:57:30",\n  "fcAuditperson" : "蔡惠芬",\n  "fnIsswotherprovinces" : "1",\n  "fcSwintogdadress" : "http://gcjs.gdwater.gov.cn/article.html?type=xy&menu_first=信用信息公开&menu_second=从业单位信用信息&menu_third=企业基本信息&id=3070&tableName=Bm211xydwQyjb&name=广州市水务科学研究所(质量检测)",\n  "fnIsjtotherprovinces" : "0",\n  "fcJtintogdadress" : null,\n  "fcBelongtrade" : null\n}'
content = json.loads(content)
print("content:", content)
# content: {'id': '2c9296bf597d9c4e0159865158763732', 'fcEntcode': 'GGZY02494', 'fcEntname': '广州市水务科学研究所', 'fcArtname': '李志威', 'fnArtpapertype': '1', 'fcArtpapersn': '420106196911205058', 'fcCountry': None, 'fcBelongareasn': '440100', 'fcBelongareasnName': '广州市', 'fcEntpropertysn': '110', 'fcIndustrysn': None, 'fcBusinesslicenseno': '124401004553512027', 'fcRegistrationno': None, 'fdBuilddate': '1978-04-29', 'fdBusinessauthority': '广州市事业单位登记管理局', 'fdVaildenddate': '2020-02-15', 'fcCreditgrade': None, 'fmEnrolfund': 1316, 'fcCurrencysn': None, 'fcEnrolbaseunit': None, 'fcEntinfodeclareperson': '李敏华', 'fdEntinfodeclaredate': None, 'fcEntinfodeclarepersontel': '13580421982', 'fcEntlinktel': '020-34289067', 'fcCaid': None, 'fcEntlinkaddr': '广州市海珠区前进路基立下道北12号', 'fcEntlinkzipcode': '                  ', 'fcEntlinkemail': 'sks2000@vip.com', 'fcRoletypesn': None, 'fnEntstatus': '1', 'fcFlowstatus': '3', 'fcAccount': '2c9296bf597d9c4e015986515875372e', 'fdCreatetime': '2017-01-10 10:59:55', 'fcCreator': 'gzsswkxyjs', 'fdModifytime': '2017-01-12 16:45:41', 'fcModifier': 'gzsswkxyjs', 'fcOrganizationcode': '124401004553512027', 'fcOrganizationauthority': '中华人民共和国国家质量监督检验检疫总局', 'fdSafelicencesdate': None, 'fdSafelicenceedate': None, 'fcSafelicencenumber': None, 'fcSafelicencecert': None, 'fcOrganizingauthority': None, 'fcOrganizingcode': None, 'fcBusinesstype': None, 'fcSubjectrole': None, 'fcRegistrationdept': None, 'fcRentregistrationno': None, 'fcRentregistrationdept': None, 'fcSocialno': None, 'fcSocialdept': None, 'fcOrganizationintro': '<span style="color:#000000;background-color:#F7FBFD;">广州市水务科学研究所(原广州市水利科学研究所,下称“水科所”)成立于1978年,是广州市水务局直属的事业单位,也是广州市水务系统唯一的科研机构。主要职能是:承担广州市水务科学研究、成果转化、科技咨询和科技推广与服务,推动水务行业科技进步。水科所建所以来一直致力于水务科研与新技术推得省、市科技进步奖二十多项,2009年度有3项产品获得广州市自主创新产品证书,有多项软广应用,为行业发展提供了有力的技术与支撑,先后获件获得中华人民共和国国家版权局颁发的计算机软件著作权登记证书上。1994年通过广东省技术监督局计量认证(CMA),2004年通过中国实验室认可委员会认可(CNAL),2009年通过中国国家合格评定委员会认可(CNAS), 是广东省水利行业首家通过CNAS实验室认可的检测单位,。 广州市水务科学研究所,即为广州市水务工程质量检测站,拥有一批国内领先的仪器设备和技术堪赞的资深专家及专业队伍,具备大型水利工程、市政供排水及其它建筑工程质量检测能力。始终以“公正、规范、准确、客观”为方针,以“一流技术、优质服务”为宗旨承接混凝土工程、岩土工程、地基与基础工程、金属结构、管材、量测、水量平衡等检测以及科研、咨询业务。承担广州市(含从化市、增城市)水务工程建设工程质量监督检测业务,承担广州市(含从化市、增城市)水务工程平行、对比、第三方检测业务,为水务建设提供真实、可靠的数据,取得良好的成效。 我单位具有水利工程质量检测混凝土工程、岩土工程、量测和金属结构甲级资质。水文、水资源调查评价乙级资质、测绘丙级资质、水土保持方案编制乙级资质、安防资质、水平衡测试资质。</span>', 'fnIsotherprovinces': '0', 'fcIntogdadress': None, 'fdEffectivedate': '2017-01-13 16:57:30', 'fcResponsibleofficer': None, 'fcIndustrycode': None, 'fdAudittime': '2017-01-13 16:57:30', 'fcAuditperson': '蔡惠芬', 'fnIsswotherprovinces': '1', 'fcSwintogdadress': 'http://gcjs.gdwater.gov.cn/article.html?type=xy&menu_first=信用信息公开&menu_second=从业单位信用信息&menu_third=企业基本信息&id=3070&tableName=Bm211xydwQyjb&name=广州市水务科学研究所(质量检测)', 'fnIsjtotherprovinces': '0', 'fcJtintogdadress': None, 'fcBelongtrade': None}
print(content.get("fcEntname"))
# 广州市水务科学研究所

每个公司都有自己的技术栈和风格,所以具体问题具体分析,此篇只做参考,也是自己太久没写爬虫遗忘了很多东西,所以做些记录,好记性不如烂笔头。

这篇关于正则(re.findall) 抓取script中的数据的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/739428

相关文章

Java注解之超越Javadoc的元数据利器详解

《Java注解之超越Javadoc的元数据利器详解》本文将深入探讨Java注解的定义、类型、内置注解、自定义注解、保留策略、实际应用场景及最佳实践,无论是初学者还是资深开发者,都能通过本文了解如何利用... 目录什么是注解?注解的类型内置注编程解自定义注解注解的保留策略实际用例最佳实践总结在 Java 编程

一文教你Python如何快速精准抓取网页数据

《一文教你Python如何快速精准抓取网页数据》这篇文章主要为大家详细介绍了如何利用Python实现快速精准抓取网页数据,文中的示例代码简洁易懂,具有一定的借鉴价值,有需要的小伙伴可以了解下... 目录1. 准备工作2. 基础爬虫实现3. 高级功能扩展3.1 抓取文章详情3.2 保存数据到文件4. 完整示例

使用Java将各种数据写入Excel表格的操作示例

《使用Java将各种数据写入Excel表格的操作示例》在数据处理与管理领域,Excel凭借其强大的功能和广泛的应用,成为了数据存储与展示的重要工具,在Java开发过程中,常常需要将不同类型的数据,本文... 目录前言安装免费Java库1. 写入文本、或数值到 Excel单元格2. 写入数组到 Excel表格

python处理带有时区的日期和时间数据

《python处理带有时区的日期和时间数据》这篇文章主要为大家详细介绍了如何在Python中使用pytz库处理时区信息,包括获取当前UTC时间,转换为特定时区等,有需要的小伙伴可以参考一下... 目录时区基本信息python datetime使用timezonepandas处理时区数据知识延展时区基本信息

Qt实现网络数据解析的方法总结

《Qt实现网络数据解析的方法总结》在Qt中解析网络数据通常涉及接收原始字节流,并将其转换为有意义的应用层数据,这篇文章为大家介绍了详细步骤和示例,感兴趣的小伙伴可以了解下... 目录1. 网络数据接收2. 缓冲区管理(处理粘包/拆包)3. 常见数据格式解析3.1 jsON解析3.2 XML解析3.3 自定义

SpringMVC 通过ajax 前后端数据交互的实现方法

《SpringMVC通过ajax前后端数据交互的实现方法》:本文主要介绍SpringMVC通过ajax前后端数据交互的实现方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价... 在前端的开发过程中,经常在html页面通过AJAX进行前后端数据的交互,SpringMVC的controll

Pandas统计每行数据中的空值的方法示例

《Pandas统计每行数据中的空值的方法示例》处理缺失数据(NaN值)是一个非常常见的问题,本文主要介绍了Pandas统计每行数据中的空值的方法示例,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是空值?为什么要统计空值?准备工作创建示例数据统计每行空值数量进一步分析www.chinasem.cn处

如何使用 Python 读取 Excel 数据

《如何使用Python读取Excel数据》:本文主要介绍使用Python读取Excel数据的详细教程,通过pandas和openpyxl,你可以轻松读取Excel文件,并进行各种数据处理操... 目录使用 python 读取 Excel 数据的详细教程1. 安装必要的依赖2. 读取 Excel 文件3. 读

Spring 请求之传递 JSON 数据的操作方法

《Spring请求之传递JSON数据的操作方法》JSON就是一种数据格式,有自己的格式和语法,使用文本表示一个对象或数组的信息,因此JSON本质是字符串,主要负责在不同的语言中数据传递和交换,这... 目录jsON 概念JSON 语法JSON 的语法JSON 的两种结构JSON 字符串和 Java 对象互转

Python正则表达式语法及re模块中的常用函数详解

《Python正则表达式语法及re模块中的常用函数详解》这篇文章主要给大家介绍了关于Python正则表达式语法及re模块中常用函数的相关资料,正则表达式是一种强大的字符串处理工具,可以用于匹配、切分、... 目录概念、作用和步骤语法re模块中的常用函数总结 概念、作用和步骤概念: 本身也是一个字符串,其中