일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- pandas
- Deep Learning
- 시각화
- 회귀모델
- 정확도
- HeidiSQL
- 알고리즘기초
- 훈련
- 해석
- 선형회기모델
- python
- 머신러닝
- 데이터
- sklearn
- tensorflow
- keras
- 데이터 수집
- 데이터 분석
- 데이터베이스
- 데이터 가공
- 예측
- MariaDB
- Database
- 딥러닝
- 파이썬
- SQL예제
- pythone
- 크롤링(crawling)
- 데이터전처리
- python기초
- Today
- Total
목록클로저 함수 (2)
코딩헤딩

1. 클로저를 이용해서 누적합 계산하기 # - 사용 함수 명 : outer_function2(), inner_function2(num) # - 사용 변수 : total(누적된 값을 저장할 변수) def outer_function2(): total = 0 print(f"#1 : total = {total}") def inner_function2(num): ### nonlocal : 클로저 구조에서느 상위 변수를 내부 함수에서 사용못함 # : 따라서, nonlocal을 지정해서 정의하면 외부 영역의 변수 사용가능 nonlocal total print(f"#2 : total = {total} / num = {num}") total += num print(f"#3 : total = {total} / num = ..

1. 유니코드 *문자열을 UTF-8로 인코딩하기 text = "안녕하세요" encode_text = text.encode("utf-8") encode_text 결과 : b'\xec\x95\x88\xeb\x85\x95\xed\x95\x98\xec\x84\xb8\xec\x9a\x94' *문자열을 UTF-8로 디코딩하기 decode_text = encode_text.decode("utf-8") decode_text 결과 : '안녕하세요' 2. 클로저 ### 클로저 함수 정의하기 def outer_function(x): # 내부 함수 정의 : 실제 실행되는 함수 def inner_function(y): s = x+y return s return inner_function ### 클로저 함수 호출하기 closur..