- 论坛徽章:
- 0
|
我用python 的 ConfigParser 读取如下文件
news.config.ini
[MACHINES]
m55:/home/seacoastboy/tmp5/
m41:/home/seacoastboy/tmp4/
m11:/home/seacoastboy/tmp1/
m35:/home/seacoastboy/tmp3/
m23:/home/seacoastboy/tmp2/
python 程序如下
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ConfigParser
import time, sys
CONFIG_PATH = './'
start = time.time()
ips = []
conf_file = CONFIG_PATH + 'config/news.config.ini'
Config = ConfigParser.SafeConfigParser()
Config.read(conf_file)
machines = Config.items("MACHINES")
print machines
输出结果如下:
[('m55', '/home/seacoastboy/tmp5/'), ('m11', '/home/seacoastboy/tmp1/'), ('m35', '/home/seacoastboy/tmp3/'), ('m41', '/home/seacoastboy/tmp4/'), ('m23', '/home/seacoastboy/tmp2/')]
疑问:
完全没有 顺序的 读取!
不知道 这是问什麽! 路过的 帮忙 解释一下 |
|