def querySubAccount(accountName): #初始化REST SDK rest = REST(serverIP,serverPort,softVersion) rest.setAccount(accountSid,accountToken) rest.setAppId(appId) result = rest.querySubAccount(accountName) for k,v in result.iteritems(): if k=='SubAccount' : if v!='': for k,s in v.iteritems(): print '%s:%s' % (k, s) else: print '%s:%s' % (k, v) else: print '%s:%s' % (k, v) #querySubAccount('子帐号名称')