python根据nagios配置文件将监控的服务联系人等信息导出到excel表格
2016-02-25 15:56
603 查看
匹配网站中的脚本<script src="public/ab.js"></script>,
并且按照其中的目录结构下载保存.
并且按照其中的目录结构下载保存.
require 'open-uri' url = 'http://www.feyasoft.com' root = '/root/Desktop/fey' open(url) do |f| f.each do |l| if l =~ /<script\stype="text\/javascript"\ssrc="(.+)"><\/script>/ file_path = $1 if file_path =~ /\/(\w+\.js)/ path, file = $`,$1 fullpath = root + path system("mkdir -p #{fullpath}") open(url + file_path) do |res| File.open(root + file_path, 'w+') do |ff| ff.write(res.readlines) end end end end end end
相关文章推荐
- Python数据分析Python库介绍(1)
- Python 多线程
- python实战第一天-socket模块练习
- python调用模块&函数
- Python——异常编码细节
- python模块系列之 - subprocess
- Python——异常基础
- 关于Python中以字母r/R,或字母u/U 开头的字符串
- Python多线程获取上证50成分股交易数据
- Python2.X UNICODE, UTF-8转换
- Python2.X UNICODE编码解码
- 【LeetCode】【Python】Linked List Cycle
- 基于Python的豆瓣电影评分查询器
- Python 通过QSTK管理和存储股票CVS数据
- View RDD contents in Python Spark
- python 列表转为字典的两个小方法
- Python3.4内置函数
- Configuring IPython Notebook Support for PySpark
- windows下安装python和依赖包的利器——Anaconda
- Python学习笔记1——Python基础