[issue38222] pathlib Path objects should support __format__

Richard report at bugs.python.org
Mon Sep 13 12:39:06 EDT 2021


Richard <nyuszika7h at gmail.com> added the comment:

I would like for this to be reconsidered. Yes, you can use str(), but converting back and forth becomes really clunky:

log_dir = 'logs/{date}'
log_file = Path(str(path).format(time.strftime('%Y-%m-%d')) / 'log.txt'

----------
nosy: +nyuszika7h

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38222>
_______________________________________


More information about the Python-bugs-list mailing list