keyword checker - keyword.kwlist

alessiogiovanni.baroni at gmail.com alessiogiovanni.baroni at gmail.com
Thu May 10 10:10:46 EDT 2007


On 10 Mag, 15:38, t... at finland.com wrote:
> Hi
>
> I try to check whether a given input is keyword or not. However this
> script won't identify keyword input as a keyword. How should I modify it
> to make it work?
>
> #!usr/bin/env python
> import keyword
>
> input = raw_input('Enter identifier to check >> ')
> if input in keyword.kwlist:
>      print input + "is keyword"
>
> else:
>      print input + "is not keyword"

Hmm... I tried, and identify it.
Try to change the 'input' variable name with other...




More information about the Python-list mailing list