티스토리 뷰

Language/Python

python type을 알려주는 function

KyeongRok Kim 2016. 9. 10. 14:31

type() 이렇게 쓴다.


a = 1

b = 2

c = a / b

로 선언을 하고


type(a)

type(b)

type(c)

를 차례로 입력한다.


결과는 아래와 같이 a는 int, b도 int, c는 float이라고 나온다.


>>> a = 10

>>> type(a)

<class 'int'>

>>> b = "hello"

>>> type(b)

<class 'str'>

>>> a = 1

>>> b = 2

>>> c = a / b

>>> type(a)

<class 'int'>

>>> type(b)

<class 'int'>

>>> type(c)

<class 'float'>



end.




728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함