Is there a standard way to get the user config directory in python

拜拜、爱过 提交于 2019-12-22 04:48:41

问题


I can get the home with os.path.expanduser("~") but is there a standard way to get the config directory? Like ~/.config in most unices, or the value of $XDG_CONFIG_HOME in (recent?) Linux and C:\Users\<user>\AppData\Local\Roaming in Windows), etc


回答1:


You can take advantage of python third party library appdirs which does all the heavy lifting for you across multiple platforms ( Windows, Linux & Mac )



来源:https://stackoverflow.com/questions/31866115/is-there-a-standard-way-to-get-the-user-config-directory-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!