I was using Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 , when i ran the folllowing code in it the corresponding error is shown .I searche
On a previous line in that interactive session, you have rebound the dict
name to some variable. Perhaps you have a line like dict={1:2}
or dict=dict(one=1, two=2)
.
Here is one such session:
>>> dict=dict(one=1)
>>> bob=dict(name='bob smith',age=42,pay='10000',job='dev')
Traceback (most recent call last):
File "", line 1, in
TypeError: 'dict' object is not callable
>>>
As a general rule, one should not use built-in type names as variable names, to prevent this error.