我尝试使用 SO 问题示例@dataclassclass WordItem: id: str = field(init=False) phrase: str word_type: WORD_TYPE def __post_init__(self): self.id = f'{self.phrase}_{self.word_type.name.lower()}'我有<ipython-input-3-df20e5b35c67> in WordItem() 3 id: str = field(init=False) 4 phrase: str----> 5 word_type: WORD_TYPE 6 7 def __post_init__(self):NameError: name 'WORD_TYPE' is not defined我的 Python 版本Python 3.6.6 :: Anaconda, Inc.WORD_TYPE 究竟是什么?
添加回答
举报
0/150
提交
取消