# Usage as a Context Manager¶

The ASDFDataSet class can also be used as a context manager which guarantees that the file is always closed after it is used.

import pyasdf

with pyasdf.ASDFDataSet("example.h5") as ds: