📜  python 获取类中的所有变量 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:26.672000             🧑  作者: Mango

代码示例1
vars = [attr for attr in dir(dino) if not callable(getattr(dino, attr)) and not attr.startswith("__")]
         
for v in vars:
    print("{0} = {1}".format(v,getattr(dino, v)))