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
  • 37,241
  • 25
  • 195
  • 267
user3058703
  • 571
  • 1
  • 8
  • 22

0 Answers0