For Linux this would give me /, for Windows on the C drive that would give me C:\. Note that python is not necessarily installed on the C drive on windows. Answer You can get the path to the Python executable using sys.executable: Then, for Windows, the drive letter will be the first part of splitdrive:
Tag: operating-system
Which os is better for development : Debian or Ubuntu? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago.
List Directories and get the name of the Directory
I am trying to get the code to list all the directories in a folder, change directory into that folder and get the name of the current folder. The code I have so far is below and isn’t working at the minute. I seem to be getting the parent folder name. I also have other files in the folder but
Is there a cross-platform way to open a file browser in Python?
I’m thinking something along the lines of the webbrowser module, but for file browsers. In Windows I’d like to open explorer, in GNOME on Linux I want to open nautilus, Konqueror on KDE, etc. I’d prefer not to kludge it up if I can avoid it. ;-) Answer I’d prefer not to kludge it up if I can avoid it.