【python】-反射

 

 

反射:

通过字符串

hasattr查看有无此方法

getattr调用该方法

均需传入实例和字符串(也就是方法名)

 

posted @ 2018-03-13 16:58  五叶草乐园  阅读(229)  评论(0编辑  收藏  举报