sw
safe-writer
pypi i safe-writer
sw

safe-writer

🧿 safer writing in Python 🧿

by Tom Ritchford

0.9.3 (see all)License:MIT
pypi i safe-writer
Readme

✏️safe_writer ✏️

A context for writing a file which leaves it unchanged if an exception is thrown.

Example:

.. code-block:: python

with safe_writer(filename) as fp: for line in source(): print(line, file=fp)

If there's an exception in the block, then filename is reverted

to its initial state

VersionTagPublished
0.9.3
3yrs ago
0.9.2
3yrs ago
0.9.1
3yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate