概述
<div class="cnblogs_code">
内容给大家分享一下...configparser模块提供了操作*.ini配置文件的一些操作方法
就如python的API中所描述的一样:
This module provides the Con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>Parser class which implements
a basic con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>uration language which provides a structure similar
to what’s found in Microsoft Windows INI files. You can use this
to write Python programs which can be customized by end users easily.
以下实现的<a href="https://www.jb51.cc/tag/gongneng/" target="_blank" class="keywords">功能</a>是:
将一些配置信息写入到指定<a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a>中,并且提供<a href="https://www.jb51.cc/tag/fangfa/" target="_blank" class="keywords">方法</a><a href="https://www.jb51.cc/tag/huoqu/" target="_blank" class="keywords">获取</a><a href="https://www.jb51.cc/tag/peizhiwenjian/" target="_blank" class="keywords">配置文件</a>中的信息
<span style="color: #800000;">'''
This module provides the Con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>Parser class which implements
a basic con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>uration language which provides a structure similar
to what’s found in Microsoft Windows INI files. You can use this
to write Python programs which can be customized by end users easily.
以下实现的<a href="https://www.jb51.cc/tag/gongneng/" target="_blank" class="keywords">功能</a>是:
将一些配置信息写入到指定<a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a>中,并且提供<a href="https://www.jb51.cc/tag/fangfa/" target="_blank" class="keywords">方法</a><a href="https://www.jb51.cc/tag/huoqu/" target="_blank" class="keywords">获取</a><a href="https://www.jb51.cc/tag/peizhiwenjian/" target="_blank" class="keywords">配置文件</a>中的信息
<span style="color: #800000;">'''
This module provides the Con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>Parser class which implements
a basic con<a href="https://www.jb51.cc/tag/fig/" target="_blank" class="keywords">fig</a>uration language which provides a structure similar
to what’s found in Microsoft Windows INI files. You can use this
to write Python programs which can be customized by end users easily.
以下实现的<a href="https://www.jb51.cc/tag/gongneng/" target="_blank" class="keywords">功能</a>是:
将一些配置信息写入到指定<a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a>中,并且提供<a href="https://www.jb51.cc/tag/fangfa/" target="_blank" class="keywords">方法</a><a href="https://www.jb51.cc/tag/huoqu/" target="_blank" class="keywords">获取</a><a href="https://www.jb51.cc/tag/peizhiwenjian/" target="_blank" class="keywords">配置文件</a>中的信息
<span style="color: #800000;">'''
下面是我做的demo,
效果:
目录下面的情况:
代码部分:
如果您也喜欢它,动动您的小指点个赞吧