Other related
One, isinstance (obj, CLS)
Checks if obj is an object of class CLS
1 class Foo (object): 2 Pass 3 4 obj = foo ()5 6 isinstance (obj, foo)
Second, Issubclass (sub, super)
Check if the sub class is a derived class of super class
1 class Foo (object): 2 Pass 3 4 class Bar (Foo): 5 Pass 6 7 Issubclass (Bar, Foo)
Third, exception handling
1. Abnormal Foundation
In the programming process in order to increase the friendliness of the program in the event of a bug will not be displayed to the user error message, but the reality of a hint of the page, popular is not to let users see the big Yellow Pages!!!
1 Try : 2 Pass 3 except Exception,ex: 4 Pass
Requirement: Add two numbers entered by the user
1 whileTrue:2NUM1 = Raw_input ('NUM1:')3num2 = Raw_input ('num2:')4 Try:5NUM1 =Int (NUM1)6num2 =Int (num2)7result = Num1 +num28 exceptException, E:9 Print 'An exception occurred with the following information:'Ten PrintEView Code
Python Experience Basics "7" Object-oriented correlation