[Python] python实现类的静态变量的代码示例 →→→→→进入此内容的聊天室

来自 , 2021-01-27, 写在 Python, 查看 167 次.
URL http://www.code666.cn/view/b8703970
  1. class CaptchaImage:
  2.     def queue(self,arr=list()):
  3.         return arr
  4.  
  5.     def InsertCode(self,code):
  6.         self.queue().append(code)
  7.  
  8.  
  9. if __name__=='__main__':
  10.     c = CaptchaImage()
  11.     c.InsertCode(1)
  12.  
  13.     b=CaptchaImage()
  14.     b.InsertCode(2)
  15.  
  16.     print(b.queue())
  17.     print(c.queue())
  18.  
  19.  
  20. #//python/7366

回复 "python实现类的静态变量的代码示例"

这儿你可以回复上面这条便签

captcha