Like the .NET in Python, you can dynamically generate an instance of the class according to the class name, but more convenient than .NET, the following example uses Python2.4's IDE IDE environment,
The .py file code is as follows:
Class
EMPLOYEE:
DEF
__init __ (Self, Name, Age, Address):
Print
'name:', Name
Print
'Age:', AGE
Print
'Address:', Address
DEF
Test (Self):
Print
'Test'
Obj =
Apply (Employee)
'Jack', 18,
'China')))
Obj.test ()
Press F5 to run, see the output result at the Shell window:
>>> ================================ r= =============================================================================================================================================================================================================== ==================
>>>
Name: Jack
AGE: 18
Address: China
Test
>>>
It is very simple.
There are three versions of Apply, you can check it out.