当前位置: 移动技术网 > IT编程>脚本编程>Python > python 获取类中除内置方法外的所有方法名

python 获取类中除内置方法外的所有方法名

2018年11月15日  | 移动技术网IT编程  | 我要评论

恶魔的恋爱咒语,驰锐人才网,龙门县人民政府

#!/usr/bin/env python
# !-*- coding:utf-8 -*-

class menu:

def __init__(self):
pass

def updateproject(self):
pass

def restartproject(self):
pass

def restarttomcat(self):
pass

def stoptomcat(self):
pass

def starttomcat(self):
pass

def methods(self):
return(list(filter(lambda m: not m.startswith("__") and not m.endswith("__") and callable(getattr(self, m)), dir(self))))

if __name__ == '__main__':
print(menu().methods())

  

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网