How take out a Specific element from a list?


How to take out a specific element from a symbol
This is my Code
[{‘symbol’: ‘LINKUSDT’, ‘orderId’: 3422916084, ‘orderListId’: -1, ‘clientOrderId’: ‘and_7e6da89c3092431b945316e541c48d78’, ‘price’: ‘7.37000000’, ‘origQty’: ‘1.62000000’, ‘executedQty’: ‘0.00000000’, ‘cummulativeQuoteQty’: ‘0.00000000’, ‘status’: ‘NEW’, ‘timeInForce’: ‘GTC’, ‘type’: ‘LIMIT’, ‘side’: ‘BUY’, ‘stopPrice’: ‘0.00000000’, ‘icebergQty’: ‘0.00000000’, ‘time’: 1654924767267, ‘updateTime’: 1654924767267, ‘isWorking’: True, ‘origQuoteOrderQty’: ‘0.00000000’}, {‘symbol’: ‘DOTUSDT’, ‘orderId’: 2973110534, ‘orderListId’: -1, ‘clientOrderId’: ‘and_7e13c97d76ee43d0a4445f05b87c7143’, ‘price’: ‘7.76000000’, ‘origQty’: ‘1.54000000’, ‘executedQty’: ‘0.00000000’, ‘cummulativeQuoteQty’: ‘0.00000000’, ‘status’: ‘NEW’, ‘timeInForce’: ‘GTC’, ‘type’: ‘LIMIT’, ‘side’: ‘BUY’, ‘stopPrice’: ‘0.00000000’, ‘icebergQty’: ‘0.00000000’, ‘time’: 1654925779775, ‘updateTime’: 1654925779775, ‘isWorking’: True, ‘origQuoteOrderQty’: ‘0.00000000’}
I Want to Print


You can do

x = [{'symbol': 'LINKUSDT', 'orderId': 3422916084, 'orderListId': -1, 'clientOrderId': 'and_7e6da89c3092431b945316e541c48d78', 'price': '7.37000000'}] 
symbol = x[0].get('symbol')

We are first accessing the dictionary which is in the list. Afterwhich we are accessing the symbol key in the dictionary — we use a .get() to fetch the corresponding value.

Answered By – Joel Lee

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published