概述
config.has_section(section_name)
什么是检查密钥是否存在的命令?
因此,在使用以下方法查询值之前,可以验证段和键是否存在:
value = config.get(section,key)
提前致谢!
config.has_option(section,option)
has_option*(section,option)* If the given section exists,and contains the given option,return True; otherwise return False. If the specified section is None or an empty string,DEFAULT is assumed.
总结
以上是编程之家为你收集整理的Python ConfigParser检查Section和Key Value的存在全部内容,希望文章能够帮你解决Python ConfigParser检查Section和Key Value的存在所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧