Python implementation gets a virtual function of a given class _python

Source: Internet
Author: User

This article describes the Python implementation of a given class of virtual function method, shared for everyone to reference. Specifically as follows:

Now take a look at the following code:

Import wx for method in 

dir (wx. Pypanel):   #这里改成给定的类 
  if Method.startswith ("Base_"): 
    Print method 

The results of the output are:

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 

Attached is a commonly used str method, the official document is as follows:
Str.startswith (Prefix[,start[,end]])

return True If string starts with Theprefix, otherwise returnfalse.prefix can also is a tuple of prefixes to . With Optionalstart, test string beginning in that position. With Optionalend, stop comparing string in that position.

If string starts with prefix, the function returns True.

I hope this article will help you with your Python programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.