有没有办法从Python的yfinance模块得到市盈率?

Is there a way to get the PE ratio from Python's yfinance module?

我想了解yfinance的市盈率

import yfinance as yf

symbol = yf.Ticker('msft').info
print(symbol['pe_ratio']) 

yfinance 中有两个可用的是 trailingPEforwardPE。获取方式:

import yfinance as yf

symbol = yf.Ticker("msft").info
symbol["trailingPE"]
symbol["forwardPE"]