"파이썬 예약어 확인하기"의 두 판 사이의 차이

라이언양 위키
둘러보기로 가기 검색하러 가기
(새 문서: 분류:파이썬분류:프로그래밍분류:Python분류:키워드분류:Snippet 파이썬에서 사용하는 키워드 목록을 출력하려면 아래와 같...)
 
 
1번째 줄: 1번째 줄:
[[분류:파이썬]][[분류:프로그래밍]][[분류:Python]][[분류:키워드]][[분류:Snippet]]
 
 
 
파이썬에서 사용하는 키워드 목록을 출력하려면 아래와 같이 입력하면 된다.
 
파이썬에서 사용하는 키워드 목록을 출력하려면 아래와 같이 입력하면 된다.
  
9번째 줄: 7번째 줄:
 
['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']
 
['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']
 
</nowiki>
 
</nowiki>
 +
 +
[[분류:파이썬]][[분류:프로그래밍]][[분류:Python]][[분류:키워드]][[분류:Snippet]]

2019년 7월 20일 (토) 17:53 기준 최신판

파이썬에서 사용하는 키워드 목록을 출력하려면 아래와 같이 입력하면 된다.

>>> import keyword
>>> print(keyword.kwlist)

['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']