首页 > 编程语言 > 详细

Python 基础 - Day 5 Learning Note - 模块 之 标准库:ConfigParser (10)

时间:2017-08-23 09:49:45      阅读:308      评论:0      收藏:0      [点我收藏+]

configparser模块介绍

用于生成和修改常见的配置文档(configuration file),  

配置文件格式

用户配置文件就是在用户登录电脑时,或是用户在使用软件时,软件系统为用户所要加载所需环境的设置和文件的集合。它包括所有用户专用的配置设置,如程序项目、屏幕颜色网络连接、打印机连接、鼠标设置及窗口的大小和位置等。一般格式包括ini,cfg,xml, config等。 配置文件的格式如下

 

[DEFAULT]
ServerAliveInterval = 45
Compression = yes
CompressionLevel = 9
ForwardX11 = yes
 
[bitbucket.org]
User = hg
 
[topsecret.server.com]
Port = 50022
ForwardX11 = no

或者

# This is a simple example with comments.
[bug_tracker]
url = http://localhost:8080/bugs/
username = dhellmann
; You should not store passwords in plain text
; configuration files.
password = SECRET

常用操作

生成配置文件

 

Python 基础 - Day 5 Learning Note - 模块 之 标准库:ConfigParser (10)

原文:http://www.cnblogs.com/lg100lg100/p/7414284.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!