9
7

More than 3 years have passed since last update.

【エラー対処】TypeError: 'list' object is not callable

Last updated at Posted at 2020-04-04

Python初心者がハマってしまったエラーへの対処を書きます。

<エラー>
TypeError: 'list' object is not callable

<原因>
関数であるlistを変数として定義してしまっている。

<対応方法>
1.whosで変数の一覧を確認し、listが変数として定義されていることを確認する。

whos

以下のように、実行結果を得られます。
listが変数として定義されてしまっています。

func        function    <function func at XXXXXXXXXXXX>

list        list        n=3

2.変数として定義してしまったlistを削除する。

del list

以上で、変数listを削除できました。
(もちろん、誤ってlistを変数定義している箇所の修正も必要。)

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7