Python: Getting AppData folder in a cross-platform way

前端 未结 4 1623
终归单人心
终归单人心 2021-02-12 21:03

I\'d like a code snippet that gets the proper directory for app data (config files, etc) on all platforms (Win/Mac/Linux at least). For example: %APPDATA%/ on Windows.

4条回答
  •  时光说笑
    2021-02-12 21:35

    If you don't mind using the appdirs module, it should solve your problem. (cost = you either need to install the module or include it directly in your Python application.)

提交回复
热议问题