def list_chunk(source_list, n):
"""
리스트를 청크 단위로 잘라낸다.
"""
return [source_list[i:i+n] for i in range(0, len(source_list), n)]
반응형
'프로그래밍 > python' 카테고리의 다른 글
날짜 하루씩 더하기 (0) | 2020.12.17 |
---|---|
정규화 (0) | 2020.12.17 |
list 에서 맨 뒤의 인덱스를 가져오는 방법. (0) | 2020.12.17 |
python json 파일 읽기 (0) | 2016.01.03 |