首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
simpleclass专题
Python:类与对象的变量[SimpleClass.py]
【异常分析】 Exception AttributeError: "'NoneType' object has no attribute 'Population'" in <bound method__del__ of <__main__.Person instance at0x00BC4D50>> ignored 在理解“类与对象的变量”时编写了下面一段程序: #coding=utf-
阅读更多...
SimpleClass:Python之面向对象编程
#coding=utf-8#定义一个类class Person:def sayHi(self): #函数定义时必须提供参数self,调用sayHi()方法时没有任何参数print 'Hi, How are you? ', self.namedef __init__(self, name):self.name = name##1#p = Person() #创建一个对
阅读更多...