On Dec 5, 2007 4:01 PM, Mahesh N <[EMAIL PROTECTED]> wrote: > I dun understand the mistake. My aim is to accept an integer number. The > python lookup in IDLE asks for a string object but the interpreter returns > with the following error message. Some one pls explain. > Thank You > > PS : I understand that i can do type conversion after getting input thru > raw_input(). But how does input() function work? > > >>> prompt="temme a number\n" > >>> speed =input(prompt) > > Traceback (most recent call last): > File "<pyshell#56>", line 1, in <module> > speed =input(prompt) > TypeError: 'str' object is not callable
You have code that you haven't shown us. My crystal ball tells me that somewhere above this point you did input = "Some String", thus shadowing the builtin input function. Start a new interpreter and try again and you should find that it works as expected. As I'm sure you'll hear from others, it really is best to use raw_input instead. If you want an integer instead of a string, do something like this: speed = int(raw_input(prompt)) That way whatever the user types isn't run as python code, just read in as a string and then converted into an integer. -- Jerry _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor