How do I identify the root of the operating system (windows: "C: \", in linux: "/"), exclusively through python commands that apply to both systems?
How do I identify the root of the operating system (windows: "C: \", in linux: "/"), exclusively through python commands that apply to both systems?
Use the commands below:
>>> import os
>>> os.path.abspath(os.sep)
'/'
Results would be:
I got the solution, gentlemen.
os.path.commonpath(os.get_exec_path())
The combination of the above commands will always display the operating system root (OS) for any OS.
: D