Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work. Try for free Learn more
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work. Try for free Learn more
以下のような、インスタンス変数としてval1とval2を持つMyClassというクラスを考えます。 class MyClass: def __init__(self, val1, val2): self.val1 = val1 self.val2 = val2 以下のように、このクラスのインスタンスを作り、printしてみます。 mc = MyClass(10, 20) print(mc) すると以下のような文字列が表示されるだけで、インスタンスのもつインスタンス変数は表示できません。 <__main__.MyClass object at 0x00000000043E4A90> インスタンス変数を全部表示するには、vars()を使うとよいようです。 print(vars(mc)) とすると、 {'val1': 10, 'val2': 20} と、インスタンス変数が表示できました。 ただし
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く