Code Fix

中級AttributeError: object has no attribute(メソッド名タイプミス)の原因と直し方 › パターン1

AttributeError: object has no attribute(メソッド名タイプミス)の原因と直し方

メソッド名の綴りミスや、他言語の命名習慣(add・trim・toUpperCaseなど)を持ち込んだときに出るエラーです。

 1  name = "tom"
 2  print(name.___________())
                    ^
Traceback (most recent call last): File "main.py", line 2, in <module> print(name.uper()) ^^^^^^^^^ AttributeError: 'str' object has no attribute 'uper'. Did you mean: 'upper'?

空欄を埋めて実行を通す

広告
広告スロット(未設定)

AttributeError: object has no attribute(メソッド名タイプミス)の原因と直し方

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)