小编Rol*_*ony的帖子

如何获取Python变量注释?

在使用带注释字段定义类/模块时,如何像函数中那样获取注释?

class Test:
  def __init__(self):
    self.x : int
t = Test()
Run Code Online (Sandbox Code Playgroud)

现在我需要从 getattr(t,'x')

python type-annotation

8
推荐指数
2
解决办法
179
查看次数

标签 统计

python ×1

type-annotation ×1