发布时间:2019-08-13 07:40:02编辑:auto阅读(2042)
#!/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
50496
49801
40398
37418
31836
28698
27629
22414
22413
20728
489°
1103°
901°
836°
1083°
959°
1571°
2940°
2619°
2014°