[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Lovepython015/Python/master/Article/PythonBasis/python8/5.md [Back]  [Original]

#  #


## 1 ##



****





****

****


## 2 ##





```python
class ClassA():
    var1 = ''

    @classmethod
    def fun1(cls):
        print('var1 ' + cls.var1)


ClassA.fun1()
```





![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-025401.png)




*  `@classmethod` 
*  `cls`   `self`
*  ` = ()`  `.()`   `.` 


 `cls`   `self` 

 



![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-032030.png)

 `self`  `aaaaaaaa` 

  `cls`  `self` 

 cls  class    self 

 self 

** self **





****



![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-034453.png)

 a  b 


## 3 ##



![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-040408.png)



****






![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-061015.png)


****



****






![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-062437.png)

****


## 4 ##



****



![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-063242.png)







****

  `. = `  

 `.() = ()` 


****








![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-09-064303.png)



Web Proxy Viewer  |  New URL  |  Original Page