发布时间:2019-08-13 07:40:02编辑:auto阅读(2221)
#!/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
51945
51737
42034
38876
33365
30333
28975
23990
23905
22264
432°
2610°
3297°
2745°
2725°
3486°
2693°
3521°
5806°
5595°