发布时间:2019-08-13 07:40:02编辑:auto阅读(2458)
#!/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
53212
40104
34472
30218
25127
24919
23316
16833
14922
14436
803°
737°
800°
812°
864°
990°
967°
980°
1078°
992°