发布时间:2019-08-13 07:40:02编辑:auto阅读(2041)
#!/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
50494
49796
40395
37415
31832
28694
27626
22409
22409
20723
480°
1097°
896°
834°
1079°
954°
1568°
2935°
2610°
2010°