Python クラスからフィールド インスタンスの値を取得する方法がわかりません。このコードで必要なことを get_person メソッドに追加しました。出力は 3 または None である必要があります。
class Digit:
def __init__(self, digit)
self.digit = digit
def get_person(self):
# I want to get the value for the field 'Person' from digit, if 'Person' exists
# else None
inst1 = Digit('Team=Hawkeye|Weapon=Bow|Person=3')
inst2 = Digit('Comics')
print(inst1.get_person(),
inst2.get_person())