配置比对脚本(python)
# -*- coding: utf- -*-
from datetime import *
import MySQLdb
import sys
import time
import datetime
import json
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='tb_test004.log',
filemode='w')
console = logging.StreamHandler()
console.setLevel(logging.INFO)
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
def process():
dict1 = {}
file1 = open("newlogic52.txt")
:
line = file1.readline()
if not line:
break
arr_line = line.split( );
:
#logging.info(arr_line[])
#logging.info(arr_line[])
key = arr_line[]
value = arr_line[]
dict1[key] = value
else:
continue
logging.info("-------------------------")
dict2 = {}
file2 = open("oldlogic52.txt")
:
line = file2.readline()
if not line:
break
arr_line = line.split( );
:
#logging.info(arr_line[])
#logging.info(arr_line[])
key = arr_line[]
value = arr_line[]
dict2[key] = value
else:
continue
f = file("hello3.txt","w+")
logging.info("************************")
sume =
for key1 in dict1:
#logging.info(key1)
#logging.info(dict1[key1])
for key2 in dict2:
# logging.info(key2)
# logging.info(dict2[key2])
if key1.strip() == key2.strip() and dict1[key1].strip() != dict2[key2].strip():
li1 = "new key:%s , value: %s \n" % (key1,dict1[key1])
#logging.info(li1)
li2 = "old key:%s , value: %s \n" % (key2,dict2[key2])
#logging.info(li2)
if key1.strip() == key2.strip() and dict1[key1].strip() == dict2[key2].strip():
sume = sume +
if key1.strip() == key2.strip() and dict1[key1].strip() == dict2[key2].strip():
li1 = "%s=%s\n" % (key1.strip(),dict1[key1].strip())
f.writelines(li1)
f.close()
dict3 = {}
file3 = open("hello3.txt")
:
line = file3.readline()
if not line:
break
arr_line = line.split( );
:
#logging.info(arr_line[])
#logging.info(arr_line[])
key = arr_line[]
value = arr_line[]
dict3[key] = value
else:
continue
for key2 in dict2:
# logging.info(key2)
# logging.info(dict3[key2])
if dict3[key2] == None:
logging.info(key2)
logging.info("@@@@@@@@@@@@@@@@@@@@@@@@@@")
logging.info(sume)
logging.info("new %s" % len(dict1))
logging.info("old %s" % len(dict2))
logging.info("same %s" % len(dict3))
if __name__ == "__main__":
process()
配置比对脚本(python)的更多相关文章
- Gitlab-CI持续集成之Runner配置和CI脚本
p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; f ...
- gitlab6 nginx配置和启动脚本
gitlab6 nginx配置和启动脚本 cheungmine 2013-10 最近把gitlab安装到了ubuntu12.04.3的虚拟机上了.参考: https://github.com/gitl ...
- Centos 配置开机启动脚本启动 docker 容器
Centos 配置开机启动脚本启动 docker 容器 Intro 我们的 Centos 服务器上部署了好多个 docker 容器,因故重启的时候就会导致还得手动去手动重启这些 docker 容器,为 ...
- 配置豆瓣镜像作为python 库的下载源
配置豆瓣镜像作为python 库的下载源 Windows 下如下配置:
- 配置基于Vim的Python开发环境
配置基于Vim的Python开发环境插件 Vundle YouCompleteMe NERDTree Vim-Jinja2-Syntax set nocompatible " be iMpr ...
- 【转】jenkins上配置robotframeworkride自动化脚本任务
jenkins上配置robotframeworkride自动化脚本任务 编写好的自动化脚本,集成在jenkins上进行自动运行于监控,这里采用分布式构建,在一台slave上进行任务构建与自动化脚本的运 ...
- ubuntu系统自动配置开机启动脚本
以前一直搞的centos配置开机启动脚本,但是相同方法用在ubuntu系统上就不管用了,非常伤脑筋. 非常感谢 https://www.linuxidc.com/Linux/2017-09/1471 ...
- 批量修改Linux密码脚本(Python)
搭建环境 centos 7.4 使用脚本 python 批量修改connect用户的密码 生成密码为随机密码 保存为xls文档 #!/usr/bin/env python # -*- coding: ...
- 配置Office Excel运行Python宏脚本
基本环境 名称 版本 操作系统 Windows 10 x64 Office 2016 安装Python 1.下载Python安装包 登录https://www.python.org/downloads ...
随机推荐
- Swift中的类型转换
写在前面:1,类型转换的两种方式 2,as!和as?的用法 3,类型判断中 is和===的用法 类型转换方式一,利用类型的构造器进行转换 let str = " var i = Int(st ...
- IOS和Android图标尺寸
刚开始接触UI的时候,碰到的最多的就是尺寸问题,今天我们就来谈谈IOS和Android 图标设计尺寸吧! 一.IOS篇 1.iOS app图标的圆角半径是多少? (注:现在IOS图标是不需要再画圆角了 ...
- 20145212——GDB调试汇编堆栈过程分析
GDB调试汇编堆栈过程分析 测试代码 #include <stdio.h> short val = 1; int vv = 2; int g(int xxx) { return xxx + ...
- Php compiler for .NET framework
https://phalanger.codeplex.com http://tomasp.net/blog/ducktyping-in-phalaner.aspx/ https://visualstu ...
- 6. web前端开发分享-css,js移动篇
随着移动市场的逐步扩大及相关技术的日趋完善,对前端开发提出了新的岗位要求,在继承前人成果的基础上需要在新的历史条件下有新的创新.移动端的开发,虽然没有IE6众多问题的折磨,但是多平台,多设备的兼容,也 ...
- [从产品角度学EXCEL 01]-EXCEL是怎样运作的
这是<从产品角度学EXCEL>系列第二篇. 前言请看:从产品角度学EXCEL-系列0-为什么要关注EXCEL的本质 本文不接受无授权转载,如需转载,请先联系我,非常感谢. 1.EXCEL是 ...
- 关于unity如何制作mmo
昨天去看了下unity的成都openday,还是有很多收获的,之前我对于这类的活动始终提不起来兴趣,不过看来日后还是要多参加下类似的活动长长见识. 公司打算开发3d mmo手游,昨天好玩123恰好也分 ...
- [Storm] Storm与asm的恩恩怨怨
asm的引用冲突 1. Jersey & Storm 0.9.3 jersey 1.8 (which depends on asm 3.0) Storm 0.93 (which depends ...
- 【Make a H5 game】JS for beginner——FROM U2B
https://www.youtube.com/watch?v=F2Dc-JlwgN4&feature=iv&src_vid=WfL4LNUL3R0&annotation_id ...
- 使用pm2管理nodejs应用
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allow ...