发布时间:2019-08-13 07:40:02编辑:auto阅读(1951)
#!/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
49331
48516
39219
36310
30722
27538
26532
21355
21205
19554
195°
404°
408°
499°
826°
571°
1243°
1278°
1191°
1179°