iode.Comments.save

Comments.save(filepath: str, compress: bool = False)

Save objects of the current database into the file ‘filepath’.

Parameters:
filepath: str

path to the file to save.

compress: bool, optional

Whether or not to compress the file. If True, the file will be written using the LZH compression algorithm. This may slow down the writing process but will reduce the size of the saved file. Default to False.

Examples

>>> from iode import SAMPLE_DATA_DIR
>>> from iode import comments
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt")         
Loading .../fun.cmt
317 objects loaded 
>>> len(comments)
317
>>> comments.save(f"{SAMPLE_DATA_DIR}/fun2.cmt")        
Saving .../fun2.cmt
317 objects saved
>>> comments.clear()
>>> comments.load(f"{SAMPLE_DATA_DIR}/fun2.cmt")        
Loading .../fun2.cmt
317 objects loaded
>>> len(comments)
317