python實(shí)現(xiàn)得到一個(gè)給定類的虛函數(shù)
本文實(shí)例講述了python實(shí)現(xiàn)得到一個(gè)給定類的虛函數(shù)的方法,分享給大家供大家參考。具體如下:
現(xiàn)來看看如下代碼:
import wx for method in dir(wx.PyPanel): #這里改成給定的類 if method.startswith("base_"): print method
輸出的結(jié)果為:
base_AcceptsFocus base_AcceptsFocusFromKeyboard base_AddChild base_DoGetBestSize base_DoGetClientSize base_DoGetPosition base_DoGetSize base_DoGetVirtualSize base_DoMoveWindow base_DoSetClientSize base_DoSetSize base_DoSetVirtualSize base_Enable base_GetDefaultAttributes base_GetMaxSize base_InitDialog base_OnInternalIdle base_RemoveChild base_ShouldInheritColours base_TransferDataFromWindow base_TransferDataToWindow base_Validate
另附一個(gè)常用的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.
如果string以prefix開頭,函數(shù)返回True.
希望本文所述對大家的Python程序設(shè)計(jì)有所幫助。
相關(guān)文章
Tensorflow: 從checkpoint文件中讀取tensor方式
今天小編就為大家分享一篇Tensorflow: 從checkpoint文件中讀取tensor方式,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-02-02對TensorFlow中的variables_to_restore函數(shù)詳解
今天小編就為大家分享一篇對TensorFlow中的variables_to_restore函數(shù)詳解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-07-07Python實(shí)現(xiàn)接受任意個(gè)數(shù)參數(shù)的函數(shù)方法
下面小編就為大家分享一篇Python實(shí)現(xiàn)接受任意個(gè)數(shù)參數(shù)的函數(shù)方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-04-04Python使用微信SDK實(shí)現(xiàn)的微信支付功能示例
這篇文章主要介紹了Python使用微信SDK實(shí)現(xiàn)的微信支付功能,結(jié)合實(shí)例形式分析了Python調(diào)用微信SDK接口實(shí)現(xiàn)微信支付功能的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下2017-06-06