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
/
C:\\\\
Using pathlib (Python 3.4+):
import sys from pathlib import Path path = Path(sys.executable) root_or_drive = path.root or path.drive