The following code:
from pathlib import Path
Desktop = Path('Desktop')
SubDeskTop = Desktop + "/subdir"
gets the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-eb31bbeb869b> in <module>()
1 from pathlib import Path
2 Desktop = Path('Desktop')
----> 3 SubDeskTop = Desktop+"/subdir"
TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'
I'm clearly doing something shady here, but it raises the question: How do I access a subdirectory of a Path
object?