发布时间:2019-08-13 07:40:02编辑:auto阅读(2240)
#!/usr/bin/python
import os
import re
hosts = open('/home/haoren/serverlist.ini')
for line in hosts:
if re.search('=',line):
ip = line.split('=')[1].strip()
hostname = os.popen('ssh %s hostname' % ip).readline().strip()
print "%s:%s" % (hostname,ip)
hosts.close()
上一篇: Python练手,pandas
下一篇: Python练习1
52033
51891
42126
38972
33471
30423
29057
24084
23999
22347
70°
108°
127°
116°
136°
130°
153°
169°
171°
175°