![]() |
1
lianghui 2014-12-02 14:31:51 +08:00 ![]() __len__ 方法
|
![]() |
2
aheadlead 2014-12-02 14:56:14 +08:00 ![]() 1L正解...
|
![]() |
3
staticor 2014-12-02 15:07:56 +08:00 ![]() 可参考http://stackoverflow.com/questions/2481421/difference-between-len-and-len 或者定义一个类后改写一下 __len__ 方法
|
![]() |
4
joshryo 2014-12-02 16:32:47 +08:00 ![]() len函数会去调用类的__len__方法,所以想要能用len函数,你定义类的时候都得写__len__方法
|