사용자 도구

사이트 도구


python:built-in

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
python:built-in [2023/04/29 17:17] – [Built-In type] taekgupython:built-in [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
 +====== python의 data type을 알아 볼까요 ======
 +
 +https://docs.python.org/3/library/stdtypes.html
 +===== Built-In type =====
 +
 +=== Boolean ===
 +  * bool
 +
 +=== Numeric ===
 +  * int
 +  * float
 +  * complex
 +
 +=== String ===
 +  * str
 +
 +=== Sequence ===
 +  * list
 +  * tuple
 +  * range
 +
 +=== Set ===
 +  * set
 +  * frozenset
 +
 +=== Mapping ===
 +  * dict
 +
 +=== Iterator ===
 +  *_<wrap>_</wrap>_iter_<wrap>_</wrap>()
 +  *_<wrap>_</wrap>_next_<wrap>_</wrap>_()
 +==== Hello World! ====
 +<code python 기초자료형>
 +# numeric
 +a = -1
 +b = 1.0
 +print(f"{type(a)} {a}")
 +print(f"{type(b)} {b}")
 +c = complex(101, 2)
 +print(f"{type(c)} {c}")
 +
 +# string
 +s1 = """0123456789-abcd"""
 +print(f"{type(s1)} {s1} {s1[0::5]}")
 +
 +# boolean
 +print(f"{type(False)} {True} {1 != 1}")
 +
 +# List
 +kk = ['k', 'asdf', "김재성"]
 +print(f"{type(kk)} {kk}")
 +
 +# Tuple
 +kk = ('k', 'asdf', "김재성")
 +print(f"{type(kk)} {kk}")
 +
 +# Dictionary
 +kk = {'name':'maro', 'nation':'Korea'}
 +print(f"{type(kk)} {kk}, len: {len(kk)}")
 +
 +</code>
 +
 +** output **
 +<code bash>
 +<class 'int'> -1
 +<class 'float'> 1.0
 +<class 'complex'> (101+2j)
 +<class 'str'> 0123456789-abcd 05-
 +<class 'bool'> True False
 +<class 'list'> ['k', 'asdf', '김재성']
 +<class 'tuple'> ('k', 'asdf', '김재성')
 +<class 'dict'> {'name': 'maro', 'nation': 'Korea'}, len: 2
 +</code>
 +