How to get Windows' special folders for currently logged-in user?

Viewed 12392

How can I get Windows special folders like My Documents, Desktop, etc. from my Python script? Do I need win32 extensions?

It must work on Windows 2000 to Windows 7.

5 Answers

A little bit hacky, but without the need of a special import

import os
os.popen('echo %appdata%').read().strip()
Related