Is there a proper platform-dependent (or independent?) path separator character somewhere in the Python standard library?
I am not asking about the directory separator / and \, but rather about the PATH separator: : and ;.
Java has java.io.File.pathSeparatorChar and java.io.File.pathSeparator to fulfill this need. Does Python have something similar? A fairly exhaustive search in os.path and pathlib docs yielded nothing, so I am beginning to lose hope.
I am not particularly hung up on the character itself. A function that behaves like os.path.join but for entire paths instead of path elements would be perfectly acceptable, preferable even.
Maybe this is what you're looking for:
import os
os.pathsep
os.pathsep is : or ; while os.sep is \ or /.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With