To find what all variables you have created so far in the session you can use the “dir()” command .
|
1 2 3 4 5 6 7 8 9 10 |
# Creating sample Variables intVar1=10 intVar2=20 srtVar="hello" # Printing all the user variables created dir() |
Sample Output in the command prompt:

Jupyter Notebook
The dir() command will work in Jupyter notebook as well. However, there is a magic command also in Jupyter its called “%whos“. You can use it to list all the user variables in python’s current session.
|
1 2 3 4 5 6 7 8 9 10 |
# Creating sample Variables intVar1=10 intVar2=20 srtVar="hello" # Printing all the user variables created in Jupyter %whos |
Sample output in Jupyter notebook

Author Details
Lead Data Scientist
Farukh is an innovator in solving industry problems using Artificial intelligence. His expertise is backed with 10 years of industry experience. Being a senior data scientist he is responsible for designing the AI/ML solution to provide maximum gains for the clients. As a thought leader, his focus is on solving the key business problems of the CPG Industry. He has worked across different domains like Telecom, Insurance, and Logistics. He has worked with global tech leaders including Infosys, IBM, and Persistent systems. His passion to teach inspired him to create this website!
