Skip to content

Instantly share code, notes, and snippets.

@santosh
Created February 26, 2013 07:22
Show Gist options
  • Save santosh/5036637 to your computer and use it in GitHub Desktop.
Save santosh/5036637 to your computer and use it in GitHub Desktop.
This script lists the python keywords. Its portable so running as $ python python_keywords.py will list for Python 2 and $ python3 python_keywords.py will return for Python 3. Basically it will list the keywords of the current interpreter.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import keyword
'''
File: python_keywords.py
Author : Santosh Kumar <https://twitter.com/sntshk>
Date created: Fri 22 Feb 2013 07:00:09 PM IST
Description: The list of python keywords
'''
print("Python version:", sys.version_info)
print("Python keywords:", keyword.kwlist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment