发布时间:2019-08-13 07:40:02编辑:auto阅读(2612)
#!/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
54487
41274
35819
31347
26245
25948
24455
20032
16032
15463
2389°
2179°
2276°
2393°
2351°
2567°
2507°
2337°
2400°
2375°