반응형
https://www.reddit.com/r/learnpython/comments/aswvgu/why_am_i_getting_an_typeerror_cannot_unpack/
When you use the for i,j in item syntax, Python is expecting that item is an iterable of iterables, which can be unpacked into the variables i and j. In this case, when you iterate over item, the individual members of item are ints, which cannot be unpacked.
If you want to unpack the items in the tuple, you should do it like this:
for i, j in a: # This unpacks the tuple's contents into i and j as you're iterating over a print(i, j)
반응형
'● 알고리즘, 자료구조 > 2019 알고리즘' 카테고리의 다른 글
백준 2884 파이썬 알람 시계 / if문 / *단순 산수 (0) | 2019.08.22 |
---|---|
★ 백준 15552 파이썬 / for / 입출력 방식 빠르게(sys.stdin.readline) 오버타임 방지 (0) | 2019.08.05 |
백준 8393 파이썬 / 누적합 / int와 len / while,for문과 break, continue / (0) | 2019.08.05 |
input, split, int (0) | 2019.07.29 |
정렬 알고리즘 (0) | 2019.06.10 |