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
/var/www/html/data/pages/context_manager.txt · 마지막으로 수정됨: 저자 127.0.0.1