相关疑难解决方法(0)

声明`class A`和`class A()`有什么区别?

我们在python中定义类如下:

class A:
    def x(self):
        print("In x")
Run Code Online (Sandbox Code Playgroud)

但我只是犯了一个错字,它在 linux cli 中使用 python 3.7 版成功执行。这里是:

class A():
    def x(self):
        print("In x")
Run Code Online (Sandbox Code Playgroud)

这是什么意思???

python class python-3.x

-1
推荐指数
1
解决办法
236
查看次数

标签 统计

class ×1

python ×1

python-3.x ×1