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 |
Tags
- Python
- 데이터분석
- 이미지읽어오기
- 머신러닝
- gitcommand
- 엑셀
- defaultbranch
- github
- 파이썬
- 통계
- 깃허브
- 일치도
- 이미지연산
- OS
- 코딩
- 코드
- 데이터
- 이미지
- git
- 카파
- windowpowershell
- powershell에러해결
- powershell에러
- 이클립스프로젝트
- image
- 라이브러리
- 프로그래밍
- 깃에러
- 파이썬에러
- 반복문
Archives
- Today
- Total
나중에 내가 보려고 만든 블로그
[Python] itertools 조합 이터레이터 생성 본문
파이썬에서 반복문을 위해 iterator를 생성할 때 길이가 다른 두개의 리스트에서 조합이 필요해서 사용했다.
데카르트 곱(cartesian product)을 생성해주며, 중첩 for 루프와 동일하다.
아래 코드는 (0 0), (0 1), ..., (29 9)까지 조합 이터레이터를 생성해주는 예시코드.
|
1
2
3
4
5
6
|
il = list(range(30))
jl = list(range(10))
import itertools
for i,j in itertools.product(il,jl) :
print(i,j)
|
cs |
'Python' 카테고리의 다른 글
| [Python] tqdm : 반복문에서 진행률 표시 (0) | 2021.08.06 |
|---|---|
| [python] feature importances (0) | 2021.05.18 |
| [python] decision tree 시각화, graphviz 리눅스 설치, 에러 (0) | 2021.05.13 |
| [Python] 'utf-8' codec can't decode byte 0xb4 in position 0: invalid start byte (0) | 2021.04.23 |
| [Python] replace 여러개 일괄 적용하기 (0) | 2021.04.22 |