문제

Is there a way to express a specific drive in both windows/linux? Windows usually uses"D:\etc" and Ubuntu/etc uses something like "/media/user/drive_name". Is there a awy to just refer to something like "/dev/sdc1" which both Windows and Ubuntu will recognize as the same drive?

I am trying to put this in a config file for a python program which can be run on an external data drive from an internal drive containing multiple OSs. The program has to refer to a separate external data drive, but I would like the program to work the same way for all of the OSs.

Is this possible?

올바른 솔루션이 없습니다

다른 팁

Either you just need to account for your OS type in each machines properties file or test for the OS in the code and act accordingly.

import os
if os.name == "windows"
    path = "D:/windows/path"
elif
    path = "/unix/path"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top