context_manager
python: Context Manager
from contextlib import contextmanager @contextmanager def Open(file, mode): f = open(file, mode) yield f f.close() @contextmanager def elapsed_time(comment="") -> float: start = time.perf_counter() yield lambda: time.perf_counter() - start
context_manager.txt · 마지막으로 수정됨: 2024/03/23 02:38 저자 127.0.0.1