context_manager
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판이전 판다음 판 | 이전 판 | ||
context_manager [2019/11/23 09:44] – rex8312 | context_manager [2024/03/23 02:38] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 9: | 줄 9: | ||
yield f | yield f | ||
f.close() | f.close() | ||
+ | | ||
+ | @contextmanager | ||
+ | def elapsed_time(comment="" | ||
+ | start = time.perf_counter() | ||
+ | yield lambda: time.perf_counter() - start | ||
</ | </ | ||
+ | |||
+ | {{tag> |
context_manager.1574502243.txt.gz · 마지막으로 수정됨: (바깥 편집)