相关疑难解决方法(0)

在Python中访问类的成员变量?

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)

然而,这也失败了.

python methods return class

68
推荐指数
3
解决办法
17万
查看次数

标签 统计

class ×1

methods ×1

python ×1

return ×1