发布时间:2019-08-13 07:40:02编辑:auto阅读(2442)
#!/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
53106
40026
34410
30161
25061
24858
23240
16719
14871
14361
706°
654°
720°
737°
783°
911°
877°
897°
991°
915°