python
追风筝的人45
微笑向暖,安之若素,你若盛开,清风自来
展开
-
python
from enum import Enum#所有枚举类是Enum类的子类# Yellow:黄钻 Green:绿钻 Black:黑钻 Red :红钻class VIP(Enum): Yellow=1 Green=2 Black=3 Red=4# print(VIP.Yellow)# yellow=1# green=2# {'yellow':1,...原创 2018-05-21 20:59:04 · 205 阅读 · 0 评论 -
python闭包
#闭包=函数+环境变量(函数定义时候)#现场def curve_pre(): a=25 def curve(x): return a*x*x return curvef=curve_pre()print(f(2))# 100## Process finished with exit code 0origin=0def facto...原创 2018-05-21 22:08:46 · 149 阅读 · 0 评论 -
python
# class Test():# pass# def __len__(self):# return 8 # def __bool__(self): # return False# test=Test()# print(bool(None))# print(bool([]))# print(bool(test))# Fa...原创 2018-05-23 16:19:16 · 195 阅读 · 0 评论