Python Forum

Full Version: PyCharm dir() not displaying output
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Trying to figure out Python and PyCharms isn't acting how I'm expecting it too.... and the dir() function isn't producing any output for me. When I run the following in PyCharms

import yfinance
dir(yfinance)
All I receive is the following without displaying the output I was expecting

Output:
Process finished with exit code 0
But when I run the same thing from the python console in Powershell it works and I receive

Output:
['Ticker', 'Tickers', '__all__', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'base', 'download', 'multi', 'pdr_override', 'shared', 'ticker', 'tickers', 'utils', 'version']
I'm running

Windows 10
Python 3.9.8
Pycharms 2021.2.3 (Community Edition)
yfinance 0.1.64

Any suggestions on what I'm doing wrong would be appreciated! Thanks
when in your shell, output is directed to stdout, thus you see the list.
when in a script, you have to direct where you want the output to go.
thus changing line 2 to print(dir(yfinance)) will show the output of the dir statement.
you could also save it in a variable, like this:
import yfinance
yfin = dir(yfinance)
print(yfin)
Worked like a charm... thank you!