I am really in the habit of using pathlib in Python and similar facilities in Java so I just write
path = HOME / "cards" / f"{card_id}" / "card.yaml" path = HOME / "cards" / f"{card_id}" / "card.yaml" path = f"{HOME}/cards/{card_id}/card.yaml"
Easier to read & write IMO, and works fine. Even on Windows. path = Path(“/foo”) / “a” / “b” / “c”
The following is functionally equivalent to the above: path = Path(“/foo”) / “a/b/c”
Which I really think was a mistake. The latter should resolve to “/foo/a\/b\/c” (IMO) because all other invalid characters (like space) are auto-escaped. What’s the point of the overloaded div operator otherwise?Even in modern versions of macOS, the GUI still allows you to create files and folders with slashes in their names; the slashes get recorded as colons in the filesystem.