0
def myFunc():
    d={}

myFunc()

If I try to access the variable d after calling this function, I get "NameError: name 'd' is not defined."

Why is this and what is the proper way to access a variable defined within a function?

Cœur
  • 34,719
  • 24
  • 185
  • 251
user3058703
  • 571
  • 7
  • 22

0 Answers0