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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/HTVJBJDJRIGL2FKZHLKI3AWOFWXVTQNB/
Code of Conduct: http://python.org/psf/codeofconduct/