我正在尝试使用 Python 3.1 找出系统文件夹的位置。例如“我的文档”=“C:\Documents and Settings\User\My Documents”、“Program Files”=“C:\Program Files”等。
I found 稍微不同的做法 http://mail.python.org/pipermail/python-win32/2005-September/003738.html。这种方式将为您提供各种系统文件夹的位置,并使用真实的单词而不是 CLSID。
import win32com.client
objShell = win32com.client.Dispatch("WScript.Shell")
allUserDocs = objShell.SpecialFolders("AllUsersDesktop")
print allUserDocs
其他可用文件夹:
AllUsersDesktop、AllUsersStartMenu、AllUsersPrograms、AllUsersStartup、桌面、收藏夹、字体、MyDocuments、NetHood、PrintHood、最近、SendTo、开始菜单、启动和模板
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)