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

3번째 줄: 3번째 줄:
;파이썬 None
;파이썬 None


<syntaxhighlight lang='python'>
<syntaxhighlight lang='python' run>
print( None )
print( None )
# None
print( type(None) )
print( type(None) )
# <class 'NoneType'>
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='python'>
<syntaxhighlight lang='python'>
13번째 줄: 11번째 줄:
if x == None:
if x == None:
print( 'x == None' )
print( 'x == None' )
# 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'>
22번째 줄: 18번째 줄:
if y != None:
if y != None:
print( 'y != None' )
print( 'y != None' )
# y != None
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>



2020년 11월 8일 (일) 00:56 판

1 개요

Python None Keyword
파이썬 None
print( None )
print( type(None) )
x = None
if x == None:
	print( 'x == None' )
if x is None:
	print( 'x is None' )
y = 0
if y != None:
	print( 'y != None' )
if y is not None:
	print( 'y is not None' )

2 같이 보기

3 참고

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