摘要: https://www.cnblogs.com/erbaodabao0611/p/7490439.html 阅读全文
posted @ 2019-07-07 22:22 世纪强风 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 一、从模块分析 ######## bb.py (一个用来导入的模块) ########## var = 0_var = 1__var = 2__var__ = 3 1. from module import * ########### aa.py ########### from bb import 阅读全文
posted @ 2019-07-06 17:43 世纪强风 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 只要定义了__str__(self)方法,那么就会打印从这个方法中return的数据 class Car: def __init__(self, newWheelNum, newColor): self.wheelNum = newWheelNum self.color = newColor def 阅读全文
posted @ 2019-07-04 11:56 世纪强风 阅读(1667) 评论(0) 推荐(0) 编辑
摘要: ######## a.py ######## aa = "Hello World" ####### b.py ######## from a import aa print aa #OK print a.aa #ERROR, 这里会报错 "a" is not defined 阅读全文
posted @ 2019-07-01 17:36 世纪强风 阅读(116) 评论(0) 推荐(0) 编辑
摘要: func(*args, **kwargs) *args, **kwargs表示函数的可变参数 *args 表示任何多个无名参数,它是一个tuple **kwargs 表示关键字参数,它是一个dict def foo(*args,**kwargs): print 'args=',args print 阅读全文
posted @ 2019-06-27 22:34 世纪强风 阅读(1958) 评论(0) 推荐(0) 编辑