I am working on a software installer for my current application. It needs to be installed to the System HDD. How owuld I detect the system drive and return the letter from Python?
Would the win32 extensions be useful? How about the os module pre packaged with Python?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you install the win32 extensions, the following will get you the information you want:
Ignore the last item, due to a terminating character in the string returned by win32's GetLogicalDriveStrings function.
This is how to return the letter of the System drive on a Win32 platform:
The above snippet returns the system drive letter. In my case ( and most cases on windows) C: