发布时间:2019-08-13 07:40:02编辑:auto阅读(2153)
#!/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
51550
51112
41648
38402
32888
29866
28582
23536
23470
21820
1966°
2668°
2221°
2157°
2605°
2186°
2915°
4840°
4681°
3325°