发布时间:2019-08-13 07:40:02编辑:auto阅读(2112)
#!/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
51283
50735
41333
38144
32610
29512
28364
23233
23199
21526
1597°
2327°
1930°
1870°
2200°
1913°
2600°
4367°
4213°
2991°