Python Tips: the tempfile library

The other day I was writing a python test, and I needed a temporary directory and file. Normally, I make these tests happen with os and pathlib libraries. It works well enough, and therefore I never had reason to change it. However, this time I asked Claude for a quick test that I was going to edit after, and it showed me the tempfile library. This module creates temporary files and directories.…