How to list default keywords in python ?

Humble Devassy Chirammal Forums Python Programming How to list default keywords in python ?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1933 Reply
    Humble
    Keymaster

    Guys, if you really tried programming in python, some times you would have received unexpected results/error with some of the variable names. If you are in a ‘IDE’ it may show the problematic variable name as soon as you type , how-ever if you are not in ide, you fail..

    Is there any way to list ‘default’ keywords defined in python ?
    Yes, here it is :

    >>>>import keyword
    >>> keyword.kwlist
    ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']
    
    
    
    Now you know !
Viewing 1 post (of 1 total)
Reply To: How to list default keywords in python ?
Your information: