-1
私はすでにDynamically get dict elements via getattr?の投稿を参照していますが、私は問題を解決できません。 私は似たようなことをしたいが、私はちょっと混乱している。私は特派辞書の(得られない)データを設定したいのですが、エラーが発生しているgetattrで動的にdict要素を設定する
AttributeError: type object 'Dicctionary' has no attribute 'VERBS'.
私のコードは次のとおりです。
class Dicctionary:
def __init__(self):
self.VERBS = dict()
self.REFERENCER = dict()
def setDictionary(self, fileDictionary, name):
methodCaller = Dicctionary()
dictionary = "self."+name.upper()
dictionary = getattr(Dicctionary, name.upper())
dictionary = fileDictionary.copy()
あなたは私が間違ってやっているかを見ることができますか?私は完全にそれを理解していないので。
私はあなたがしたいと思うのは 'dictionary = getattr(methodCaller、name.upper())'ですが、正確に何を達成したいのか分かりません。 – ettanany
エラーを引き起こす行や、エラーを再現するのに十分なコード、結果/出力を表示していないことを示していません。 – martineau