发布时间:2019-08-13 07:40:02编辑:auto阅读(2667)
#!/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
54830
41613
36197
31649
26550
26253
24779
20365
16321
15743
2828°
2588°
2681°
2826°
2769°
2994°
2908°
2739°
2751°
2722°