摘要: 初学Python,零零散散的大概花了三天时间看了《简明Python教程》,整理笔记的过程还是很有意义的。文档地址:http://sebug.net/paper/python/index.html《简明 Python 教程》笔记-----面向对象及系统相关1、缩进: 就是指块,相当于C里面的{ },对齐就是{ 跟 }匹配number = 1while number < 5: print numbernumber += 1print 'Done'上面的代码会一直输出1,因为下一句number+=1不在while的范围内2、运算符与它们的用法http://sebug.net/p 阅读全文
posted @ 2012-04-22 17:56 kfinder 阅读(787) 评论(0) 推荐(0) 编辑
摘要: 文档地址:http://sebug.net/paper/python/index.html《简明 Python 教程》笔记-----基础知识1、类①.每个函数都有个self参数,代表对象,类和对象所属变量,相当于C++中的‘静态变量’和‘某对象变量’ 如果类Person self.name为对象变量,Person.name为类变量class Person: population = 0 def__init__(self ,name): self.name = name population = population + 1 def __del__(self): popul... 阅读全文
posted @ 2012-04-22 17:53 kfinder 阅读(631) 评论(2) 推荐(0) 编辑