python 内置函数getattr

2021-03-17  本文已影响0人  不能没有音乐

如果 self.tag 存在返回 tag 本身的值,不存在返回 None

    tag = getattr(self, 'tag', None)
上一篇 下一篇

猜你喜欢

热点阅读