I have a list of class object like this,
cls_list = [cls_object1,cls_object2,cls_object3]
which is created by using __import__
and getattr
how i can get all the functions inside those classes(cls_object1,cls_object2,cls_object3) in to one new class(new_class), i tried
class new_class([cls_object1,cls_object2,cls_object3]):
but not working.
You can use type(name, bases, dict)
to create a new class with a list of class as bases.
new_class = type("new_class", cls_list, {})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.