发布时间:2019-08-13 07:40:02编辑:auto阅读(2508)
#!/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
53534
40356
34758
30519
25395
25185
23598
18881
15177
14690
1155°
1079°
1147°
1167°
1202°
1356°
1315°
1287°
1387°
1330°