发布时间:2019-08-13 07:40:02编辑:auto阅读(2160)
#!/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
51592
51180
41683
38445
32931
29912
28622
23587
23516
21865
2022°
2733°
2282°
2210°
2682°
2237°
2984°
4920°
4778°
3393°