keyword checker - keyword.kwlist
- From: tom@xxxxxxxxxxx
- Date: Thu, 10 May 2007 13:38:40 GMT
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"
.
- Follow-Ups:
- Re: keyword checker - keyword.kwlist
- From: Steven D'Aprano
- Re: keyword checker - keyword.kwlist
- From: alessiogiovanni . baroni
- Re: keyword checker - keyword.kwlist
- Prev by Date: RE: change of random state when pyc created??
- Next by Date: Re: Towards faster Python implementations - theory
- Previous by thread: trouble with generators
- Next by thread: Re: keyword checker - keyword.kwlist
- Index(es):
Relevant Pages
|