keywords , Python में predefined कुछ words होते जिनका कुछ मतलब होता है। और इन words / keywords के नाम के variables , constant variables, modules , class names , functions etc. हम नहीं बना सकते है , क्योंकि इससे हमरे द्वारा बनाए गए variables और actual keywords में confusion होती है , इसलिए हम इन्हे define नहीं कर सकते हैं। और अगर हम ऐसा करते भी है तो error आएगी।

Python Keywords List

python में keyword module का use करके सभी predefined python keywords के बारे में जान सकते हैं।

Copy Fullscreen Close Fullscreen Run
import keyword
print(keyword.kwlist)
Output
C:\Users\Rahulkumar\Desktop\python>python py_keywords.py
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 
'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 
'return', 'try', 'while', 'with', 'yield']

तो कुछ इस तरह से हम python में keywords की listing करा सकते हैं। अब इन keywords के बारे में जानेंगे कि ये keywords use क्यों होते हैं।

Keyword Name Description
False / True ये दोनों ही Boolean values हैं।
Noneयह None / empty value define करता है।
andयह as a logical operator की तरह use किया जाता है , यह sure करता है कि किसी condition में दी गयी सभी condition true हैं।
orयह भी एक logical operator की तरह use किया जाता है , यह sure करता है कि दो conditions में से एक condition true हैं।
breakbreak keyword का use loop में किसी specified condition पर loop को break / exit करता है।
classइसका use class define करने के लिए किया जाता है।
continuecontinue, किसी loop में किसी specified condition पर single iteration को skip करता है।
defdef का use function define करने के लिए किया जाता है।
ifयह if statement define करता है , जिसमे condition true होने पर ही यह run होता है।
elseयह if statement साथ use किया जाता है ,  जिसमे condition false होने पर ही यह run होता है।
tryइसका use exception handling के लिए किया जाता है , इसमें वो code लिखते हैं जिसमे exception  chances होते हैं।
exceptयह  try के साथ ही work करता है , exception आने पर यह run होता है।
finallyयह try , except के साथ run होता है। यह दोनों case में run होता है exception आने पर भी और न आने पर भी।
importimport का use user defined या predefined modules को import करने के लिए किया जाता है।
forयह for loop define करने के लिए use किया जाता है।
whilewhile का use, while loop define करने के लिए किया जाता है।
lambdalambda का use lambda functions define करने के लिए किया जाता है।
returnreturn किसी function में value return करने के लिए use किया जाता है।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers