Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- computer
- function
- Linux
- for
- Java
- architecture
- instruction
- while
- mysql
- github
- DS
- Class
- html
- data structure
- react
- DB
- control
- MIPS
- DATAPATH
- system
- python
- php
- DoM
- web
- CSS
- javascript
- MacOS
- XML
- Algorithm
- Pipelining
Archives
- Today
- Total
목록unpacking (1)
YYYEJI
[Python] 튜플의 packing, unpacking 이해하기
튜플 packing은 튜플(or 리스트)의 값들을 묶는 것을 말합니다. 튜플 unpacking은 묶인 값들을 푸는 것을 말합니다. 예제를 살펴봅시다. 아래 예제는 튜플을 출력하는 예제입니다. num = (1, 2, 3, 4, 5) print(num) 아래 예제는 하나의 튜플로 되어 있는 객체를 각각의 변수에 담는 코드입니다. num = (1, 2, 3, 4, 5) one, two, three, four, five = num print(one, two, three, four, five) 각가의 변수가 아닌 어느 특정 부분의 객체들을 한 변수에 list로 담을 수도 있습니다. num = (1, 2, 3, 4, 5) one, two, *other = num print(one, two, other) 변수 앞에 ..
Python
2022. 10. 13. 16:27