0

I know there a lot of path API's in python, but I am looking for an API that will give me the very root directories of the system the script is executing in. Not root directories of the script itself but the actual system.

So, for a standard windows laptop I would expect at least

C:\

And then if I have something connnected, like an android device via USB something for that to.

Any tips? Note my particular interest here is for windows.

Thanks.

More Than Five
  • 9,959
  • 21
  • 77
  • 127
  • In regards to the pluralization "root directories": Are referring to drives mounted on the system in the Windows OS? POSIX systems only have one root directory. Please give more detail. – Andrew Sledge Jul 02 '13 at 11:21

1 Answers1

1

Try this code:

>>> import os
>>> os.path.expandvars("%SystemRoot%")
'C:\\Windows'