這是我的字典如何在給定值時在Python中的字典中獲取密鑰?
finance={
'sno' : 'None',
'fin_ticker' : 'what',
'marketcap' : ['what','how much'],
'e_value' : ['what', 'how much'],
'ret_on_assets' : ['how much', 'what'],
'tot_cash' : 'what',
'op_cash' :'what',
'lev_free_cf' :'what',
'tot_debt' : 'what',
'curr_ratio' : ['what', 'how much'],
'gross_profit' :['what', 'how much'],
'prof_margin' :['what', 'how much'],
'last_trade' : ['what', 'how much'],
'trade_time' : ['what', 'when'],
'prev_close' : ['what', 'how much'],
}
我需要得到密鑰的value..for實例給出當我給一個值作爲「什麼」它會顯示關於該值,如下所示
fin_ticker
marketcap
e_value
ret_on_assets
tot_cash
op_cash
lev_free_cf
tot_debt
curr_ratio
gross_profit etc...
所有鍵
謝謝@Kasra其工作 – Murali
@Murali不客氣;) – Kasramvd