TypeError: 'str' object is not callable
pythonで TypeError: 'str' object is not callable なるエラーが発生しました。
print("f = " str(f)) # 計算結果の表示
TypeError: 'str' object is not callable
原因
str は組み込み関数なので 変数名に str を使わないように注意。
ついつい使ってしまいがちw
組み込み関数
以下は組み込み関数なので 変数名に使わないように注意。
str, next, sum, len などは使ってしまいがちなので注意。
abs() dict() help() min() setattr()
all() dir() hex() next() slice()
any() divmod() id() object() sorted()
ascii() enumerate() input() oct() staticmethod()
bin() eval() int() open() str()
bool() exec() isinstance() ord() sum()
bytearray() filter() issubclass() pow() super()
bytes() float() iter() print() tuple()
callable() format() len() property() type()
chr() frozenset() list() range() vars()
classmethod() getattr() locals() repr() zip()
compile() globals() map() reversed() __import__()
complex() hasattr() max() round()
delattr() hash() memoryview() set()