发布时间:2019-08-13 07:40:02编辑:auto阅读(2681)
#!/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
54958
41754
36341
31772
26672
26365
24889
20495
16437
15855
2986°
2712°
2812°
2958°
2895°
3157°
3047°
2893°
2883°
2862°