发布时间:2019-08-13 07:40:02编辑:auto阅读(2471)
#!/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
53264
40147
34523
30264
25174
24965
23369
16891
14963
14476
852°
779°
851°
859°
913°
1033°
1027°
1022°
1131°
1043°