[Python] Built-in Function isinstance
Function for Checking the Type of Data: isinstance() Pass the value of the data to be checked and the type of data to check as parameters. isinstance(instance,c
GGAMI
Function for Checking the Type of Data: isinstance() Pass the value of the data to be checked and the type of data to check as parameters. isinstance(instance,c
Pass the value of the data to be checked and the type of data to check as parameters.
자료형 확인 - 정수
# 문제 : 100은, 정수 타입 인가?
result = isinstance(100, int)
print(f'isinstance(100,int) : {result}')
>>> isinstance(100, int) : True
다중 타입 확인 - 정수,실수,문자열
# 문제 : 100은, 정수,실수,문자열 타입 중 하나인가?
result = isinstance(100, (int,float,str))
print(f'isinstance(100,(int,float,str)) : {result}')
>>> isinstance(100,(int,float,str)) : True