发布时间:2019-08-13 07:40:02编辑:auto阅读(2307)
#!/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
52364
52283
42413
39304
33776
30735
29480
24402
24267
22638
147°
152°
163°
180°
155°
271°
260°
280°
279°
330°