class Example(object):
def the_example(self):
itsProblem = "problem"
theExample = Example()
print(theExample.itsProblem)
Run Code Online (Sandbox Code Playgroud)
如何访问类的变量?我试过添加这个定义:
def return_itsProblem(self):
return itsProblem
Run Code Online (Sandbox Code Playgroud)
然而,这也失败了.