python 中是否有获取用户配置目录的标准方法

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

我可以通过 os.path.expanduser("~") 获取主页,但是是否有获取配置目录的标准方法?像大多数 unice 中的 ~/.config,或(最近?)Linux 中的 ~/.config 和 Windows 中的 C:\Users\<user>\AppData\Local\Roaming 的值,等等

您可以利用 python 第三方库 appdirs,它可以跨多个平台为您完成所有繁重的工作(Windows、Linux 和 Mac)