代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Python
】
统计Python
作者:
天远
/ 发布于
2016/4/12
/
942
class Host(object): def __init__(self): self.name = None self.ping_ok = "None" self.mgtr_info = "" self.yop = "" class COP_ng(object): def __init__(self, name ="",ip ="",status = "", mrtg=""): self.name = name self.ip = ip self.status = status self.mrtg = mrtg class Imp_agent(object): def __init__(self, version="",ip = "", update_time="",name = ""): self.name = name self.ip = ip self.version = version self.update_time = update_time def get_yops(): f = open("yop_info.csv","r") yops = [] for i in f.readlines(): i = i.strip() if not i.strip(): print(i) continue print(1,i) name,ip,status,mrtg = i.split('","') name = name.strip('"') ip = ip.strip('"') status = status.strip('"') mrtg = mrtg.strip('"') yops.append(COP_ng(name=name, ip =ip, status=status,mrtg = mrtg)) return yops def get_imps(): f = open("imp_agent.csv","r") yops = [] for i in f.readlines(): ip,name, version, update_time = i.split(",") yops.append(Imp_agent(name=name, ip =ip, version=version, update_time= update_time )) return yops def get_yop_pand(filename): f = open(filename) return [i.strip() for i in f.readlines()] yop_pand_ok = set(get_yop_pand("COP_pand.txt")) imp_pand_ok = set(get_yop_pand("host_ok")) ping_ok = set(get_yop_pand("ping.txt")) yop_infos = get_yops() imp_infos = get_imps() def imp_search(host): for i in imp_infos: if i.name == host: return i else: continue return Imp_agent() def main(): files = open("info.txt", "w") for yop in yop_infos: yop.imp = imp_search(yop.name) yop.ping_ok = "ok" if yop.ip in ping_ok else "error" yop.yop_pand_ok = "ok" if yop.name in yop_pand_ok else "error" yop.imp_pand_ok = "ok" if yop.name in imp_pand_ok else "error" info = '"{yop_name}","{yop_ip}","{yop_pand}","{yop_status}","{yop_mrtg}","{imp_version}","{imp_update}","{imp_pand}","{ping_status}"'\ .format ( yop_name = yop.name, yop_ip = yop.ip, yop_pand = yop.yop_pand_ok, yop_status = yop.status, yop_mrtg = yop.mrtg, imp_version = yop.imp.version, imp_update = yop.imp.update_time, ping_status = yop.ping_ok, imp_pand = yop.imp_pand_ok ) files.write(info+'\n') files.flush() print(info) main()
试试其它关键字
Python
同语言下
.
比较两个图片的相似度
.
过urllib2获取带有中文参数的url内容
.
不下载获取远程图片的宽度和高度及文件大小
.
通过qrcode库生成二维码
.
通过httplib发送GET和POST请求
.
Django下解决小文件下载
.
遍历windows的所有窗口并输出窗口标题
.
根据窗口标题调用窗口
.
python 抓取搜狗指定公众号
.
pandas读取指定列
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
天远
贡献的其它代码
(
16
)
.
杀死所有脚本
.
小程序页面里要播放的音频的总时长
.
C#打开、保存图像
.
重写HttpServletRequest的获取参数防止xss攻击
.
获取ResultSet列数
.
显示路径下图片
.
返回字符串A的小写格式
.
多行多列数据转为一行
.
负载均衡算法
.
遍历实体的所有属性并为属性赋值
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3