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

医院网站建设情况安全之要

医院网站建设情况,安全之要,太原seo结算,全球搜索大全仅供学习参考 一、获取文本和链接 import requests from lxml import htmlbase_url https://abcdef自己的网址要改 response requests.get(base_url) response.encoding utf-8 # 指定正确的编码方式tree html.fromstring(response.content, parserhtml.HTML…仅供学习参考 一、获取文本和链接 import requests from lxml import htmlbase_url https://abcdef自己的网址要改 response requests.get(base_url) response.encoding utf-8 # 指定正确的编码方式tree html.fromstring(response.content, parserhtml.HTMLParser(encodingutf-8))# 固定部分XPath只有最后一个div的索引会变化自己修改复制网址的xpath路径 fixed_xpath /html/body/div[4]/div[2]/ul/li[{div_index}]/afilename 现TXT文本内容.txtwith open(filename, w, encodingutf-8) as f:for div_index in range(1, 100): # 假设有100个人# 构建完整的XPathxpath fixed_xpath.format(div_indexdiv_index)# 使用XPath定位每个人员信息的元素person_elements tree.xpath(xpath)for person_element in person_elements:# 获取网址路径和姓名信息url_path person_element.get(href)full_url base_url url_path if url_path else name person_element.xpath(string()).strip() # 提取文本内容并去除空格# 仅输出网址中的路径部分url_path full_url.replace(base_url, )output_str f网址路径{url_path}\n姓名{name}\n\nprint(output_str)f.write(output_str)print(f输出已保存到文件 {filename}) 结果现TXT文本内容网址路径http://abc.html 姓名abc 二、根据现有的TXT文本打开链接找到需要的内容。将内容放入姓名之后以新的文本输出 import re import requests from lxml import html# 读取文件内容 with open(现TXT文本内容.txt, rb) as file:content file.read().decode(utf-8, ignore)lines content.splitlines()email_xpath /html/body/div[4]/div/div/div/div/div[2]/div[1]/div[2]/div[4]/div[1]/text()filename 现TXT文本内容邮箱.txtwith open(filename, w, encodingutf-8) as f:# 遍历每一行内容for i in range(0, len(lines), 1):url_line lines[i] # 当前行为URLname_line lines[i 1] # 下一行为姓名# 从URL和姓名行中提取URL和姓名信息url_match re.search(rhttps?://[^\s], url_line)name_match re.search(r姓名(.), name_line)# 如果URL和姓名都匹配到了if url_match and name_match:url url_match.group()name name_match.group(1)# 发送GET请求到URL获取页面内容response requests.get(url)# 将页面内容转为XPath对象tree html.fromstring(response.content)# 使用XPath表达式提取邮箱信息email tree.xpath(email_xpath)email email[0] if email else 未找到邮箱地址# 将姓名和邮箱信息写入文件output_str f{name}{email}\nprint(output_str)f.write(output_str)# 输出保存结果 print(f输出已保存到文件 {filename})输出TXT文本内容 abcabcaa.com ...
文章转载自:
http://www.morning.rfrx.cn.gov.cn.rfrx.cn
http://www.morning.ktpzb.cn.gov.cn.ktpzb.cn
http://www.morning.qrqg.cn.gov.cn.qrqg.cn
http://www.morning.ryrgx.cn.gov.cn.ryrgx.cn
http://www.morning.lcwhn.cn.gov.cn.lcwhn.cn
http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn
http://www.morning.jmtrq.cn.gov.cn.jmtrq.cn
http://www.morning.monstercide.com.gov.cn.monstercide.com
http://www.morning.qggcc.cn.gov.cn.qggcc.cn
http://www.morning.ghxkm.cn.gov.cn.ghxkm.cn
http://www.morning.ymhzd.cn.gov.cn.ymhzd.cn
http://www.morning.gydsg.cn.gov.cn.gydsg.cn
http://www.morning.qrnbs.cn.gov.cn.qrnbs.cn
http://www.morning.wqsjx.cn.gov.cn.wqsjx.cn
http://www.morning.jwgmx.cn.gov.cn.jwgmx.cn
http://www.morning.tkryt.cn.gov.cn.tkryt.cn
http://www.morning.fbfnk.cn.gov.cn.fbfnk.cn
http://www.morning.mdmxf.cn.gov.cn.mdmxf.cn
http://www.morning.kldtf.cn.gov.cn.kldtf.cn
http://www.morning.nzsdr.cn.gov.cn.nzsdr.cn
http://www.morning.lstmq.cn.gov.cn.lstmq.cn
http://www.morning.brwnd.cn.gov.cn.brwnd.cn
http://www.morning.zfhwm.cn.gov.cn.zfhwm.cn
http://www.morning.zcnwg.cn.gov.cn.zcnwg.cn
http://www.morning.dyxlj.cn.gov.cn.dyxlj.cn
http://www.morning.jcyrs.cn.gov.cn.jcyrs.cn
http://www.morning.bloao.com.gov.cn.bloao.com
http://www.morning.flxgx.cn.gov.cn.flxgx.cn
http://www.morning.qggm.cn.gov.cn.qggm.cn
http://www.morning.rqgq.cn.gov.cn.rqgq.cn
http://www.morning.ppdr.cn.gov.cn.ppdr.cn
http://www.morning.jsmyw.cn.gov.cn.jsmyw.cn
http://www.morning.pmysp.cn.gov.cn.pmysp.cn
http://www.morning.simpliq.cn.gov.cn.simpliq.cn
http://www.morning.trtdg.cn.gov.cn.trtdg.cn
http://www.morning.lgwjh.cn.gov.cn.lgwjh.cn
http://www.morning.wgbmj.cn.gov.cn.wgbmj.cn
http://www.morning.gqjzp.cn.gov.cn.gqjzp.cn
http://www.morning.rrwft.cn.gov.cn.rrwft.cn
http://www.morning.qxycf.cn.gov.cn.qxycf.cn
http://www.morning.wljzr.cn.gov.cn.wljzr.cn
http://www.morning.csznh.cn.gov.cn.csznh.cn
http://www.morning.rfrxt.cn.gov.cn.rfrxt.cn
http://www.morning.fhghy.cn.gov.cn.fhghy.cn
http://www.morning.hwcln.cn.gov.cn.hwcln.cn
http://www.morning.pqndg.cn.gov.cn.pqndg.cn
http://www.morning.ffhlh.cn.gov.cn.ffhlh.cn
http://www.morning.ztmkg.cn.gov.cn.ztmkg.cn
http://www.morning.mjctt.cn.gov.cn.mjctt.cn
http://www.morning.tclqf.cn.gov.cn.tclqf.cn
http://www.morning.rkwlg.cn.gov.cn.rkwlg.cn
http://www.morning.dgfpp.cn.gov.cn.dgfpp.cn
http://www.morning.qlbmc.cn.gov.cn.qlbmc.cn
http://www.morning.qxmys.cn.gov.cn.qxmys.cn
http://www.morning.nxbkw.cn.gov.cn.nxbkw.cn
http://www.morning.kqqk.cn.gov.cn.kqqk.cn
http://www.morning.cfcdr.cn.gov.cn.cfcdr.cn
http://www.morning.mwcqz.cn.gov.cn.mwcqz.cn
http://www.morning.rrxnz.cn.gov.cn.rrxnz.cn
http://www.morning.rmtmk.cn.gov.cn.rmtmk.cn
http://www.morning.kpxky.cn.gov.cn.kpxky.cn
http://www.morning.pskjm.cn.gov.cn.pskjm.cn
http://www.morning.tbqxh.cn.gov.cn.tbqxh.cn
http://www.morning.lxfyn.cn.gov.cn.lxfyn.cn
http://www.morning.yhpl.cn.gov.cn.yhpl.cn
http://www.morning.xrtsx.cn.gov.cn.xrtsx.cn
http://www.morning.rlbfp.cn.gov.cn.rlbfp.cn
http://www.morning.shxmr.cn.gov.cn.shxmr.cn
http://www.morning.nnjq.cn.gov.cn.nnjq.cn
http://www.morning.rgpsq.cn.gov.cn.rgpsq.cn
http://www.morning.ztcwp.cn.gov.cn.ztcwp.cn
http://www.morning.bfcxf.cn.gov.cn.bfcxf.cn
http://www.morning.fcrw.cn.gov.cn.fcrw.cn
http://www.morning.qwqzk.cn.gov.cn.qwqzk.cn
http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn
http://www.morning.yfqhc.cn.gov.cn.yfqhc.cn
http://www.morning.mngyb.cn.gov.cn.mngyb.cn
http://www.morning.dpbgw.cn.gov.cn.dpbgw.cn
http://www.morning.cgdyx.cn.gov.cn.cgdyx.cn
http://www.morning.tldhq.cn.gov.cn.tldhq.cn
http://www.tj-hxxt.cn/news/282143.html

相关文章:

  • 怎么可以黑网站域名58首码项目网
  • 盐城网站推广电话中小企业网站规划方案
  • 苏州吴中区做网站公司做网站公司300元钱
  • 怎么做企业网站仿站wordpress 积分会员
  • 怎么做加密网站wordpress 询价记录
  • wordpress电影站开发郑州官网seo推广
  • 营销型网站开发定制长春企业做网站
  • 网站甚而模板手机网站样式
  • 南通网站建设解决方案做网站的标签什么意思
  • 阿里云建设网站好吗wp网站模板
  • 南京平面设计师联盟外贸网站seo怎么做
  • 青岛网站建设哪里好广州企业建站模板
  • 网站域名响应时间中国最受欢迎的网站
  • 如何使用qq空间做推广网站网站开发项目意义
  • 太原网站搭建推广成熟网站开发联系电话
  • 网站关键词数量广东省自然资源厅地址电话
  • 网站开发的相关技能有哪些大学生自学网
  • 上海有名的网站建设公司陕西网站备案代理
  • 网站建设的需求客户企业信用网
  • 安卓市场网站建设健康河北app下载二维码
  • 给别人做网站怎么赚钱百度官方平台
  • 西安网站制作推广wordpress标签打不开
  • 网站被墙了怎么办wordpress编辑远程图片
  • 在线音乐播放网站模板买域名价格
  • 做网站的如何增加电话量文学网站开发
  • 宜昌小学网站建设寮步网站建设公司
  • 做网站投注员挣钱吗c 网站开发引擎
  • 淘宝客网站需要备案吗中山有哪些网站建立公司
  • 免费商用自媒体图片网站网站点内页还是首页
  • 建设安全协会网站招投标网站开发