[英]parsing a config.ini file in python
so I have a config.ini file which I have to parse and use in my python script, I basically need to run a loop to get the REPOS_TO_CHECK in my script, can anyone help out in how to parse the file and run it in a loop in my script to get the REPOS_TO_CHECK parameters. 所以我有一个config.ini文件,必须在python脚本中进行解析和使用,我基本上需要运行一个循环以在脚本中获取REPOS_TO_CHECK,谁能帮助您解析该文件并在其中运行在我的脚本中循环以获取REPOS_TO_CHECK参数。 Thanks. 谢谢。
GITHUB_URL = 'https://api.github.com'
GITHUB_ACCESS_TOKEN = 'xxx'
REPOS_TO_CHECK = [
('org1', 'repo1'),
('org2', 'repo2'),]
Use the configparser library. 使用configparser库。
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.