In article <d84aa18f-7c12-4262-a746-218581783...@googlegroups.com>, fl <rxjw...@gmail.com> wrote:
> >>> a = 1234 > >>> [int(d) for d in str(a)] > Traceback (most recent call last): > File "<interactive input>", line 1, in <module> > TypeError: 'str' object is not callable This looks like you've overwritten str with an *instance* of a string. When a python interpreter starts up, there are certain pre-defined symbols. For example, 'str' is bound to the string class. But, there's nothing to prevent you from re-defining it. Here's an example which produces the same result you got: --------------------------------------------------------------------- $ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> str = "foo" >>> a = 1234 >>> [int(d) for d in str(a)] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object is not callable --------------------------------------------------------------------- -- https://mail.python.org/mailman/listinfo/python-list