如何将应用程序设置保存在配置文件中? [英] How to save application settings in a config file?
本文介绍了如何将应用程序设置保存在配置文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个程序,它有一个设置窗口,我可以在其中更改程序的各种参数.在某种配置文件中读取/保存它们的最佳方法是什么?我知道有些软件和游戏使用 .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 标准库包括 ConfigParser
模块,为您处理 ini 样式的配置文件.对于大多数用途来说已经足够了.
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屋!
查看全文