python:

把config.ini文件成map返回

def get_conf(conf_file):
conf = {}
ll=list(map(lambda x: x.replace('"', '').replace('\n', ''),
filter(lambda x: "=" in x and not x.startswith("#"), open(conf_file).readlines())))
for i in ll:
conf[i[0:i.index('=')]]=i[i.index("=")+1:]
return conf common_config=get_conf(CONF_PATH+'/common.conf')

shell:

shell脚本比较简单。

直接source config.ini 就会把等值对(变量和对应的值)传递到linux环境

轮子:读取config.ini文件的更多相关文章

  1. C#对config.ini文件进行读取和修改

    C#对config.ini文件进行读取和修改: public partial class Patrolcar : Form之后可以加入如下类: #region public class IniFile ...

  2. C语言实现 读取写入ini文件实现(转)

    #include <stdio.h> #include <string.h> /* * 函数名: GetIniKeyString * 入口参数: title * 配置文件中一组 ...

  3. boost::property_tree读取解析ini文件--推荐

    boost::property_tree读取解析ini文件 #include "stdafx.h" #include <iostream> #include <b ...

  4. 1. 在config.ini文件中加入dm.park.time=1,会使uap中的tomcat启动加快

    在config.ini文件中加入dm.park.time=1,会使uap中的tomcat启动加快

  5. C#中选中指定文件并读取类似ini文件的内容

    一.背景 由于项目中需要去读取设备的配置信息,配置文件的内容和INI配置文件的格式类似,所以可以按照INI文件的方式来处理.涉及如何打开一个文件,获取打开的文件的路径问题,并读取选中的文件里边的内容. ...

  6. C++ 中使用boost::property_tree读取解析ini文件

    boost 官网 http://www.boost.org/ 下载页面 http://sourceforge.net/projects/boost/files/boost/1.53.0/ 我下载的是  ...

  7. vc读取当前路径和读取配置ini文件

    //获取路径 std::string GetApplicationDir() { HMODULE hModule = GetModuleHandleW(NULL); WCHAR wpath[MAX_P ...

  8. python读取ini文件

    import configparser import os config=configparser.ConfigParser()#创建config对象 file_path=os.path.dirnam ...

  9. C# 读取ini文件 百度问问学习文档

    C# 读取ini文件 10 有多个section,现想读取整个ini文件和指定section下所有内容 补充: 发布答案可以,请对准题目啊,我不要指定节点的内容,我知道!我要的是读取指定区域的内容,假 ...

随机推荐

  1. 修改linux内核启动顺序

    修改linux内核启动顺序 # 修改内核启动顺序x86_64 centos:cat /boot/grub2/grub.cfg |grep "menuentry" grub2-set ...

  2. 阿里云Zabbix安装实践过程

    1.配置阿里云zabbix yum源 [root@VM_0_8_centos ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhe ...

  3. C# WPF DataGrid在Grid中自适应窗体大小

    XAML 中设置   例如 <DataGrid AutoGenerateColumns="False" Margin="6" Name="dgV ...

  4. eclipse 建立 web fragment project 工程

    1.鼠标右键---------new ---------Other 2.选择WEB----web fragment project 3.输入工程名,点finish

  5. yum tenxun ntpdate 时间同步

    centos7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base ...

  6. 用IDEA开发Spring程序

    操作步骤 https://www.cnblogs.com/zyx110/p/11023218.html

  7. [转帖].MegaRAID SAS 9361-8i 开箱 极简测试

    [配件开箱] 谁说raid0软硬没多大区别的...MegaRAID SAS 9361-8i 开箱 极简测试 [复制链接] https://www.chiphell.com/thread-1810952 ...

  8. VNC 设置分辨率 --TigerVNC

    之前写过如何设置vnc https://www.cnblogs.com/jinanxiaolaohu/p/9110002.html 如果想设置vnc的分辨率的话 也很简单 如图示: vncserver ...

  9. [转帖]备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改

    备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改 https://blog.csdn.net/toontong/article/details/50440272 ...

  10. PostgreSQL查看等待锁的SQL和进程

    查看等待锁的查询和进程: The following query may be helpful to see what processes are blocking SQL statements (t ...