zoukankan      html  css  js  c++  java
  • 模块 configparser

    import configparser
    # ConfigParser模块
    # 生成一个configparser
    config = configparser.ConfigParser()
    config.add_section('666')
    config.set('666', 'hnm1', '1')
    config.set('666', 'hnm2', '2')
    with open('aoao.cnf', 'w') as cfg:
        config.write(cfg)
    
    
    # 读取configparser
    config = configparser.ConfigParser()
    config.read('my.cnf')
    print(config.sections())
    print(config['mysqld']['join_buffer_size'])
    
    # 删除一个section
    sec = config.remove_section('mysqld')
    config.write(open('my.cnf','w'))
    
    # 判断有没有sections
    sec = config.has_section('mysqld1')
    print(sec)
  • 相关阅读:
    前端资源网址
    IDEA激活工具
    新建jsp项目
    jsp笔记
    iOS的SVN
    iOS学习网站
    测试接口工具
    MVP模式
    关于RxJava防抖操作(转)
    注释模板
  • 原文地址:https://www.cnblogs.com/hinimix/p/8514199.html
Copyright © 2011-2022 走看看