1.getattrgetattr(self, 'key') 这种获取方式会报错,又不想用try catch
可以用getattr(self, 'key',None)
2.hasattr
hasattr(self, "key") 返回true或false