Filtering/selecting 变量输出 = 简单的简单问题,但我不知道如何搜索正确的解决方案

Filtering/selecting a variable output = easy simple question but i don't know how to search for the right solution

我确定这很简单,但我找不到合适的词来解释我对 Google 的意思,所以我的搜索结果是空的。

我有一个正在打印到控制台的变量。都好。

我想要 filter/select 变量输出,这样我就可以在新变量中引用它。我只是不知道该命令的正确语法。

这是变量:

all_orderbooks = client.get_orderbook_ticker()

print(all_orderbooks)

然后输出大量数据,这里是一个片段:

[{'symbol': 'ETHBTC', 'bidPrice': '0.02475200', 'bidQty': '0.00800000', 'askPrice': '0.02475700', 'askQty': '112.26500000'}, {'symbol': 'LTCBTC', 'bidPrice': '0.00469900', 'bidQty': '0.05000000', 'askPrice': ' 0.00470100', 'askQty': '70.00000000'}, {'symbol': 'BNBBTC', 'bidPrice': '0.00177020', 'bidQty': '73.94000000', 'askPrice': '0.00177060', 'askQty': '10.34000000'}, {'symbol': 'NEOBTC', 'bidPrice': '0.00112600', 'bidQty': '8.71000000' , 'askPrice': '0.00112700', 'askQty': '981.97000000'}, {'symbol': 'QTUMETH', 'bidPrice': '0.00734200', 'bidQty' : '296.42000000', 'askPrice': '0.00736400', 'askQty': '296.33000000'}, {'symbol': 'EOSETH', 'bidPrice': '0.01107500', 'bidQty': '300.00000000', 'askPrice': '0.01108900', 'askQty': '300.00000000'}, {'symbol': 'SNTETH', 'bidPrice': ' 0.00010647', 'bidQty': '10188.00000000', 'askPrice': '0.00010703', 'askQty': '1917.00000000'}, {'symbol': 'BNTETH', 'bidPrice': '0.00345900', 'bidQty': '0.82000000', 'askPrice': '0.00346000', 'askQty': '535.00000000'}, {'symbol': 'BCCBTC' , 'bidPrice': '0.00000000', 'bidQty': '0.00000000', 'askPrice': '0.00000000', 'askQty': '0.00000000'}, {'symbol': 'GASBTC' , 'bidPrice': '0.00017920', 'bidQty': '11.55000000', 'askPrice': '0.00017980', 'askQty': '115.18000000'}, {'symbol': 'BNBETH', 'bidPrice': '0.07145400', 'bidQty': '23.87000000', 'askPrice': '0.07154800', 'askQty': '93.35000000'}, {'symbol': 'BTCUSDT', 'bidPrice': '9280.37000000', 'bidQty': '0.02339500', 'askPrice': '9280.38000000', 'askQty': '0.49950000'}, {'symbol': 'ETHUSDT', 'bidPrice': '229.74000000', 'bidQty': '1.76697000', 'askPrice': '229.75000000', 'askQty': ' 144.09608000'}, {'symbol': 'HSRBTC', 'bidPrice': '0.00000000', 'bidQty': '0.00000000', 'askPrice': '0.00000000', 'askQty': '0.00000000'}, {'symbol': 'OAXETH', 'bidPrice': '0.00000000', 'bidQty': '0.00000000', 'askPrice': '0.00000000' , 'askQty': '0.00000000'}, {'symbol': 'DNTETH', 'bidPrice': '0.00000000', 'bidQty': '0.00000000', 'askPrice' : '0.00000000', 'askQty': '0.00000000'}, {'symbol': 'MCOETH', 'bidPrice': '0.02187700', 'bidQty': '44.94000000', 'askPrice': '0.02205000', 'askQty': '0.48000000'}, {'symbol': 'ICNETH', 'bidPrice': '0.00000000', 'bidQty': ' 0.00000000', 'askPrice': '0.00000000', 'askQty': '0.00000000'}, {'symbol': 'MCOBTC', 'bidPrice': '0.000542 90', 'bidQty': '7.00000000', 'askPrice': '0.00054390', 'askQty': '0.30000000'}, {'symbol': 'WTCBTC', 'bidPrice': '0.00003810', 'bidQty': '922.47000000', 'askPrice': '0.00003830', 'askQty': '8641.66000000'}, {'symbol': 'WTCETH' , 'bidPrice': '0.00153900', 'bidQty': '3.35000000', 'askPrice': '0.00154800', 'askQty': '43.06000000'}, {'symbol': 'LRCBTC', 'bidPrice': '0.00000992', 'bidQty': '785.00000000', 'askPrice': '0.00000997', 'askQty': '25373.00000000'}, {'symbol': 'LRCETH', 'bidPrice': '0.00040116', 'bidQty': '98.00000000', 'askPrice': '0.00040320', 'askQty': '67.00000000'}, {'symbol': 'QTUMBTC', 'bidPrice': '0.00018200', 'bidQty': '1.23000000', 'askPrice': '0.00018220', 'askQty': ' 915.96000000'}, {'symbol': 'YOYOBTC', 'bidPrice': '0.00000110', 'bidQty': '82154.00000000', 'askPrice': '0.00000111', 'askQty': '365041.00000000'}, {'symbol': 'OMGBTC', 'bidPrice': '0.00016630', 'bidQty': '938.17000000', 'askPrice': '0.00016670' , 'askQty': '900.83000000'}, {'symbol': 'OMGETH', 'bidPrice': '0.00671100', 'bidQty': '330.64000000', 'askPrice' : '0.00673800', 'askQty':

我希望能够 filter/select 文本中的特定主题,即 "symbol:" 然后只显示符号。

我想我必须创建一个新变量并指定我想要的目标,即 print(all_orderbooks.symbol) 或 print(all_orderbooks)_symbol,但迄今为止的努力没有结果。

如有任何帮助,我们将不胜感激。

这是我的决定

all_orderbooks = client.get_orderbook_ticker()
for order in all_orderbooks:
    ordersymbol = (order['symbol'])
    print(ordersymbol)

非常感谢

好的,我想出来了,它有效,但如果有更好的方法,我肯定很乐意学习:)

all_orderbooks = client.get_orderbook_ticker() all_orderbooks 的订单: ordersymbol = (order['symbol']) 打印(订单符号)

谢谢大家!