标签:配置 conf style print 文件 log adl with int
#!/usr/bin/env python3 import re with open("conf", ‘r‘) as f: num = ‘5‘ # reStr = re.compile(r‘(?<![\.\d])(?:\d{1,3}\.){3}\d{1,3}(?![\.\d])‘) re_Str = ‘(?<![\.\d])(?:\d{1,3}\.){3}\d{1,3}(?![\.\d])‘ re_Str1 = ‘([a-z]+)_[0-9]‘ for line in f.readlines(): line = re.sub(re_Str, ‘192.168.1.2‘,line) line = re.sub(re_Str1, ‘windows_‘+num, line) print(line ,end=‘‘) ~
标签:配置 conf style print 文件 log adl with int
原文地址:http://www.cnblogs.com/baitutu/p/6005969.html