Bor*_*lik 4 python windows path
python程序需要找到openoffice.org的安装位置,该安装位置安装在Windows XP计算机上.做这个的最好方式是什么?
您可以_winreg在Windows上使用该模块:首先找出注册表中的路径(例如,启动regedit.exe并使用其查找功能).然后你可以查询这条路径,就像我做了一次找到R的主目录:
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "Software\\R-core\\R")
value = _winreg.QueryValueEx(key, "InstallPath")[0]
Run Code Online (Sandbox Code Playgroud)
增加:
如果你不熟悉windows regstry:请看http://en.wikipedia.org/wiki/Windows_Registry