"Python 튜플인지 확인"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
3번째 줄: 3번째 줄:


== True ==
== True ==
<source lang='python' run>
<syntaxhighlight lang='python' run>
x = (1,2,3)
x = (1,2,3)
print( isinstance(x, tuple) )
print( isinstance(x, tuple) )
</source>
</syntaxhighlight>


== False ==
== False ==
<source lang='python' run>
<syntaxhighlight lang='python' run>
x = [1,2,3]
x = [1,2,3]
print( isinstance(x, tuple) )
print( isinstance(x, tuple) )
</source>
</syntaxhighlight>
<source lang='python' run>
<syntaxhighlight lang='python' run>
x = '1,2,3'
x = '1,2,3'
print( isinstance(x, tuple) )
print( isinstance(x, tuple) )
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2021년 10월 27일 (수) 20:17 기준 최신판

1 개요[ | ]

Python 튜플인지 확인

2 True[ | ]

x = (1,2,3)
print( isinstance(x, tuple) )

3 False[ | ]

x = [1,2,3]
print( isinstance(x, tuple) )
x = '1,2,3'
print( isinstance(x, tuple) )

4 같이 보기[ | ]

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