私は次のことをしようとしています:
for index, image_properties in enumerate(list_of_properties):
index = str(index)
しかし、私は取得し続けます
TypeError at /
'str' object is not callable
ここで何が問題になっていますか?
私は次のことをしようとしています:
for index, image_properties in enumerate(list_of_properties):
index = str(index)
しかし、私は取得し続けます
TypeError at /
'str' object is not callable
ここで何が問題になっていますか?
コメント投稿者が述べたように、どこかで定義している必要があり、組み込み関数をstr
オーバーライドします。str
Pythonでは、このようなシンボルを簡単に「再バインド」できます。たとえば、このセッションを参照してください。
>>> str(2)
'2'
>>> def str(x): return x + 1
...
>>> str(2)
3
>>> str = 1
>>> str(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
さらに、あなた のテキストは、それが以前のどこかで文字列オブジェクトとして定義されてTypeError
いることを示唆しています。str