文档里有解释的:
On Windows, HOME and USERPROFILE will be used if set, otherwise
a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user
is handled by stripping the last directory component from the created
user path derived above.
--
Best regards,
lilydjwg
Linux Vim Python 我的博客
http://lilydjwg.is-programmer.com/
--
chlin
不光英文的会出问题。就算是中文的,“桌面”文件夹也可以设置为其它目录的(比
如放到 D 盘对习惯把桌面当临时文件夹的人来说是个非常好的主意)。
--
Best regards,
lilydjwg
Linux Vim Python 我的博客
http://lilydjwg.is-programmer.com/
窃以为光是读注册表的话,用_winreg模块就可以了,没必要引入win32api依赖关系的。。。
当然如果你其他地方依赖win32api这样写就可以接受- -
from win32com.shell import shell
def GetDesktoppath():
ilist = shell.SHGetSpecialFolderLocation(0,shellcon.CSIDL_DESKTOP)
dtpath = shell.SHGetPathFromIDList(ilist)
return dtpathWin7没有本地化问题,中英文操作系统都是Desktop。