We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e35ed12 commit 8349428Copy full SHA for 8349428
Article/PythonBasis/python8/3.md
@@ -29,12 +29,12 @@ class 就是类,method 就是方法。
29
30
因此类方法,想要调用类属性,需要以下步骤:
31
32
-* 在方法上面,用 `@classmethon` 声明该方法是类方法。只有声明了是类方法,才能使用类属性
+* 在方法上面,用 `@classmethod` 声明该方法是类方法。只有声明了是类方法,才能使用类属性
33
* 类方法想要使用类属性,在第一个参数中,需要写上 `cls` , cls 是 class 的缩写,其实意思就是把这个类作为参数,传给自己,这样就可以使用类属性了。
34
* 类属性的使用方式就是 `cls.变量名`
35
36
37
-记住喔,无论是 `@classmethon` 还是 `cls` ,都是不能省去的。
+记住喔,无论是 `@classmethod` 还是 `cls` ,都是不能省去的。
38
39
省了都会报错。
40
0 commit comments