랭귀지/python
Python type() Check Python data type
유키공
2018. 10. 1. 09:30
Check Python data type
Python에서는 데이터타입을 확인 하기 위해서는 type() 을 사용하여 확인 합니다.
print(type(123)) print(type(12.3)) print(type('123'))
# <class 'int'> # <class 'float'> # <class 'str'>
print(type([])) print(type([1, 2, 3, 4, 5])) print(type({})) print(type(()))
# <class 'list'> # <class 'list'> # <class 'dict'> # <class 'tuple'>
print(type(None))
# <class 'NoneType'>
print(type('한글')) print(type(u'한글'))
# <class 'str'> # <class 'str'>