"파이썬 None"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(같은 사용자의 중간 판 5개는 보이지 않습니다)
2번째 줄: 2번째 줄:
;Python None Keyword
;Python None Keyword
;파이썬 None
;파이썬 None
* 파이썬 자료형 중 하나
* return 이 없는 함수에서 반환되는 값을 출력할 때 흔히 볼 수 있다.


<syntaxhighlight lang='python'>
<syntaxhighlight lang='python' run>
print( None )
print( None )
# None
</syntaxhighlight>
<syntaxhighlight lang='python' run>
print( type(None) )
print( type(None) )
# <class 'NoneType'>
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='python'>
<syntaxhighlight lang='python' run>
x = None
x = None
if x == None:
if x == None:
print( 'x == None' )
print( 'x == None' )
# x == None
</syntaxhighlight>
<syntaxhighlight lang='python' run>
x = None
if x is None:
if x is None:
print( 'x is None' )
print( 'x is None' )
# x is None
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='python'>
<syntaxhighlight lang='python' run>
y = 0
y = 0
if y != None:
if y != None:
print( 'y != None' )
print( 'y != None' )
# y != None
</syntaxhighlight>
<syntaxhighlight lang='python'  run>
y = 0
if y is not None:
if y is not None:
print( 'y is not None' )
print( 'y is not None' )
# y is not None
</syntaxhighlight>
<syntaxhighlight lang='python'  run>
def greet():
    print("hello")
result = greet()
print('result=', result)
</syntaxhighlight>
</syntaxhighlight>


==같이 보기==
==같이 보기==
* [[null]]
* [[null]]
* [[none]]
* [[파이썬 is]]
* [[파이썬 is]]
* [[파이썬 is not]]
* [[파이썬 is not]]
37번째 줄: 48번째 줄:
* https://www.w3schools.com/python/ref_keyword_none.asp
* https://www.w3schools.com/python/ref_keyword_none.asp


[[분류: Python]]
[[분류: Python 자료형]]

2020년 11월 8일 (일) 01:00 기준 최신판

1 개요[ | ]

Python None Keyword
파이썬 None
  • 파이썬 자료형 중 하나
  • return 이 없는 함수에서 반환되는 값을 출력할 때 흔히 볼 수 있다.
print( None )
print( type(None) )
x = None
if x == None:
	print( 'x == None' )
x = None
if x is None:
	print( 'x is None' )
y = 0
if y != None:
	print( 'y != None' )
y = 0
if y is not None:
	print( 'y is not None' )
def greet():
    print("hello")
result = greet()
print('result=', result)

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}