Home print only user's variables in interactive mode
Reply: 0

print only user's variables in interactive mode

user759 Published in March 20, 2018, 5:37 am

I am in the interactive mode of the python 3 interpreter.

I have created some variables of different data types. after some time I want to see a list of all variables that I have created. this can be done by using 'dir()'.

but the 'dir()' builtin function will print not just the variables that I have created, but also the special python builtin variables: ['annotations', 'builtins', 'doc', 'loader', 'name', 'package', 'spec']

of course this is and could be very helpful in many cases, but for a beginner it's a little bit irritating.

so, how could I print just and only my variables?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.392534 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO