发布时间:2019-08-13 07:40:02编辑:auto阅读(2123)
#!/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
51347
50810
41406
38204
32696
29588
28418
23308
23261
21591
1672°
2401°
2008°
1944°
2279°
1975°
2680°
4484°
4315°
3073°