Correction; I intended to use with_suffix() for the second example:
>>> old_path = Path(r"C:\x.txt") >>> old_path.with_name("y").with_suffix(old_path.suffix) WindowsPath('C:/y.txt')
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/HTVJBJDJRIGL2FKZHLKI3AWOFWXVTQNB/ Code of Conduct: http://python.org/psf/codeofconduct/