我正在创建一个 python 脚本来提取jboss-cli.sh
默认情况下以以下格式返回输出的值:
{ “结果” => “成功”, “结果” => { "活动计数" => "0", "可用计数" => "0", "平均阻塞时间" => "0", "平均创建时间" => "0", "CreatedCount" => "0", "DestroyedCount" => "0", "InUseCount" => "0", "MaxCreationTime" => "0", "MaxUsedCount" => "0", "MaxWaitCount" => "0", "MaxWaitTime" => "0", "超时" => "0", "TotalBlockingTime" => "0", "TotalCreationTime" => "0", “启用统计” => false } }
现在我使用以下代码将其转换为 JSON 格式:
from jbossply.jbossparser import JbossParser
parser = JbossParser()
print(parser.parse(OUT))
所以它给出的输出为:
{u'outcome': u'success', u'result': {u'AverageBlockingTime': u'0', u'AvailableCount': u'0', u'statistics-enabled': False, u'MaxCreationTime': u'0', u'MaxUsedCount': u'0', u'CreatedCount': u'0', u'MaxWaitCount': u'0', u'TimedOut': u'0', u'InUseCount': u'0', u'ActiveCount': u'0', u'TotalBlockingTime': u'0', u'DestroyedCount': u'0', u'AverageCreationTime': u'0', u'TotalCreationTime': u'0', u'MaxWaitTime': u'0'}}
现在如何从中提取“AvailableCount”。试过 json.load 但不工作。