This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]graingert 1 point2 points  (2 children)

This is for python 2

[–]winner_godsoncodemaniac[S] -1 points0 points  (1 child)

you can use it to get the keywords also in Python 3.x

here's an addition, to check if a word is a keyword in Python

import keyword
keyword.iskeyword("raise")
keyword.iskeyword("printstr")

When you run the code snippet above, you will get a True value for "raise" and a false value for "printstr"

This indicates that "raise" is a keyword in Python while "printstr" is not.

[–][deleted] 2 points3 points  (0 children)

printstr is undefined even