我这里有很多台机器,希望每次可以属于只需要输入序号就可以登录,但同时我的数组标注是字符串,同时又不希望每次输入很多个字母
各位提供下思路?
import os
from array import *
dblist={}
dblist["adb"] =" ssh root@1"
dblist["bdb"] ="ssh root@2"
dblist["cdb"] =" ssh root@3"
dblist["ddb"] = "ssh root@4"
dblist["edb"] ="ssh root@5"
count=0
print dblist
print "ID,name,IP"
for key in dblist:
print count,key,dblist[key]
count=count+1
content = raw_input ("Choose which id you would like to go:")
print content
print dblist[content]
os.system (dblist[content])