如何将应用程序设置保存在配置文件中? [英] How to save application settings in a config file?

查看:267
本文介绍了如何将应用程序设置保存在配置文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有设置窗口的程序,可以在其中更改程序的各种参数.在某种配置文件中读取/保存它们的最佳方法是什么?我知道某些软件和游戏使用.ini文件或类似系统.如何在Python中实现此目标?

I am developing a program that has a settings window in which I can change various parameters for my program. What is the best way to read/save them in some kind of config file? I know that some software and games use .ini files or similar system. How can I achieve this in Python?

推荐答案

Python标准库包含

The Python standard library includes the ConfigParser module, which handles ini-style configuration files for you. It's more than adequate for most uses.

这篇关于如何将应用程序设置保存在配置文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆