发布时间:2019-08-13 07:40:02编辑:auto阅读(2184)
#!/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
51714
51376
41807
38579
33061
30071
28738
23736
23646
22014
2232°
2918°
2439°
2386°
2960°
2387°
3195°
5252°
5067°
3618°