Join paths in Python given operating system

python

Solution

Usually all of the different path modules are included, `os.path` is just the one for your local machine. Import `ntpath` if you want to do Windows path manipulation, and `posixpath` for Unix path manipulation.

Problem

Background - I am using paramiko to put files on a bunch of remote servers, running several different operating systems, and with no Python installed on the remote systems. I need to specify remote directories for where the file should be put. Because different operating systems specify paths differently, I wanted to use some module. I wanted to use `os.path.join`, but that gets its configuration from my local machine. Is there any way to specify the platform in one of the os module's methods, or something similar? EDIT: Also during ssh sessions with paramiko.

Original source