我想知道一个类是否位于一个类中。
例如:
class Example:
class InsideExample:
pass
我想检查InsideExample
是否在Example
内。我该怎么办?
谢谢。
答案 0 :(得分:1)
您可以将isinstance
与class
一起使用,以检查该属性是否为class Example:
class InsideExample:
pass
if hasattr(Example, 'InsideExample') and isinstance(Example.InsideExample, type):
pass
:
<span onclick="UpdateFeatures(this,false);"> [checkbox* InterestsAndGoals id:getStartedInterestsAndGoals use_label_element "Growth" "Marketing Exposure" "Increase in overall traffic" "Edge over your competition" "Increase in low season traffic"]</span>