In article <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]> wrote:
[ ... ]
>> Try to change the 'input' variable name with other...
>Changed input variable to myInput, but the result is still the same.

That was good advice, but isn't going to help here. Because "input"
isn't a keyword, it's a builtin. If you want to check builtins as
well as keywords, you need
>>> if myInput in keyword.kwlist + dir(__builtins__):
(Although obviously you'd pre-build that list.)

>for example, 'else' isn't identified as a keyword by the script though 
>it exists in keyword.kwlist.

?
>>> def check():
...     input = raw_input('Enter identifier to check >> ')
...     if input in keyword.kwlist:
...             print input, "is keyword"
...     else:
...             print input, "is not keyword"
...
Enter identifier to check >> input
input is not keyword
>>> check()
Enter identifier to check >> else
else is keyword
>>>

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to