python_得到一个给定类的虚函数

来源:互联网 发布:最近4g移动网络好差劲 编辑:程序博客网 时间:2024/06/03 19:42

上代码再说:


import wxfor method in dir(wx.PyPanel):#这里改成给定的类    if method.startswith("base_"):        print method

输出的结果为:

base_AcceptsFocusbase_AcceptsFocusFromKeyboardbase_AddChildbase_DoGetBestSizebase_DoGetClientSizebase_DoGetPositionbase_DoGetSizebase_DoGetVirtualSizebase_DoMoveWindowbase_DoSetClientSizebase_DoSetSizebase_DoSetVirtualSizebase_Enablebase_GetDefaultAttributesbase_GetMaxSizebase_InitDialogbase_OnInternalIdlebase_RemoveChildbase_ShouldInheritColoursbase_TransferDataFromWindowbase_TransferDataToWindowbase_Validate



另附一个常用的str的方法:

str.startswith(prefix[,start[,end]])

Return True if string starts with theprefix, otherwise returnFalse.prefix can also be a tuple of prefixes to look for. With optionalstart, test string beginning at that position. With optionalend, stop comparing string at that position.

函数返回True,如果string以prefix开头...


good luck..