//=$secondUrl?>
Python
데이터형 확인하기, 데이터 타입 확인하기
데이터형 확인하기, 데이터 타입 확인하기
이번시간에는 데이터형을 확인하는 방법에 대해서 알아봅시다.
데이터형을 확인하려면 type함수를 사용합니다.
type() 사용 방법
type(값)
자 그럼 type함수안에 각각의 값을 넣어서 결과를 확인 해 봅시다.
먼저 int형 1입니다. 과연 int가 나올까요?
type(1)
위의 결과를 출력하려면 print함수안에 넣으면 됩니다. 그럼 코드가 다음과 같죠.
print(type(1))

결과는 바로 아래에서 확인할 수 있습니다.

결과를 보면 <class 'int'>가 나옵니다.
즉, 데이터형은 int입니다.
보통 프로그래밍 언어에서 타입을 확인하면 int만 나오는데 파이썬에서는 <class 'int'> 이러한 값을 출력하네요.
그럼 이번에는 "1"입니다. 정말로 str(문자형)으로 값이 나오는지 봅시다.
print(type("1"))

결과는 바로 아래에서 확인할 수 있습니다.

당연하게도 str로 나옵니다.
그럼 실수와 정수를 합한 값 즉 int + float의 결과는 어떻게 나올까요?
print(type(1 + 4.3))

결과는 바로 아래에서 확인할 수 있습니다.

답은 5.3이기 때문에 당연히 float입니다.
이렇게 데이터형을 확인하는 type()함수에 대해서 알아봤습니다.
//=$langList['bottomThankyou'][$langMode]?>