美文网首页
python读取.properties配置文件

python读取.properties配置文件

作者: 沫明 | 来源:发表于2019-10-10 17:35 被阅读0次

    如图配置文件config2.properties


    image.png image.png

    python获取里面的某个值

    import ConfigParser
    ticket_config = ConfigParser.ConfigParser()
    ticket_config.read('/data/config/lcc_ticket_info/config2.properties')
    username = ticket_config.get("MMB2B","LTHKB2B.username")
    print (username)
    
    image.png

    相关文章

      网友评论

          本文标题:python读取.properties配置文件

          本文链接:https://www.haomeiwen.com/subject/spuapctx.html