일상 코딩
[링크] 파이썬 배열 회전, zip(), *, tuple() 본문
728x90
Python Zip 2차원 배열 회전
1. zip 내장 함수(BIF) zip은 각 iterables의 요소들을 하나씩 모아 이터레이터를 만듭니다. iterable (이터러블) 멤버들을 한 번에 하나씩 돌려줄 수 있는 객체. 이터러블의 예로는 모든 (list, str, tuple 같
comdoc.tistory.com
https://choichumji.tistory.com/74
[python] 2차원 리스트 90도 돌리기
def rotated(array_2d): list_of_tuples = zip(*array_2d[::-1]) return [list(elem) for elem in list_of_tuples] # return map(list, list_of_tuples) 테스트 arr = [[1,2,3],[4,5,6],[7,8,9]] nm_arr = [[1,2],..
choichumji.tistory.com
728x90
'Python > 유용한 python 문법' 카테고리의 다른 글
[링크] 파이썬 리스트, 튜플 정렬 sort(), sorted(), reverse() (0) | 2021.11.13 |
---|---|
[링크] 파이썬 함수 입력 변수 여러개 받기 (0) | 2021.11.11 |