0

I learned that all variables, function, namespace in global scope becomes a property of window object offered from browser, which is accessible in Javascript through console. Is there any object similar to this in Python?

1 Answers1

1

globals() returns a dictionary that contains all global variables, maybe similar to what you are looking for.

globals()
> {'__builtins__': ... }

type(globals())
> <class 'dict'>

You may also interested in

  • dir(): list of scoped variables
  • locals():dictionary of local variables