Python读取INI(确认你的编译器中安装了相应的软件)配置文件

1.简介
- read(filename) 读取ini文件内容
- sections() 以列表形式展示所有的section
- options(section) 展示该section的option
- items(section) 得到该section的所有键值对
- get(section,option) 得到section中option的值,返回为string类型
- getint(section,option) 得到section中option的值,返回int类型,还有相应的getboolean()和getfloat()函数。
2.动态写入配置文件
- add_section(section) 添加一个新的section
- set(section,option,value) 新增section中的option
3.例子

Python读取INI配置文件

Python读取INI配置文件

4.ConfigParser Module
RawConfigParser是最基础的ini文件读取类
ConfigParser、SafeConfigParser支持参数解析

相关文章:

  • 2019-03-12
  • 2021-09-13
  • 2021-12-07
  • 2021-09-13
  • 2021-09-19
  • 2021-09-13
  • 2021-09-13
  • 2021-09-13
猜你喜欢
  • 2019-11-26
  • 2019-01-15
  • 2021-09-13
  • 2020-03-13
  • 2021-09-13
  • 2021-09-13
  • 2021-09-13
  • 2021-09-13
相关资源
相似解决方案