我有一个像这样的JSON: {
"a": "hi",
"b": 4213,
"c": 23154646789132456,
"d": "a very long string that should be shortened",
"e": {
"x": "some value",
"y": {
"alpha": "foo"
}
}
} 我想使用j
基于的一个答案,可以使用nargs成功地传递列表。
但是,当从json文件中实际检索到列表时,我不知道如何正确地传递列表。所有的尝试都会返回一个列表,我想知道如何从命令行成功地完成这个任务(即在python脚本中不使用json解析)。
主要尝试使用一个玩具例子(非常类似于上面提到的帖子)。
app_parsing_lists.py
import argparse
# defined command line options
# this also generates --help and error handling
CLI=argparse.ArgumentParser()
CLI.add_
我正在尝试读取gitlab CI中的yaml文件。我在CI工作中使用pip安装了jq==1.0.2和yq==2.10.1,并使用python:3.7image。当我尝试读取yaml文件时,它出现以下错误 yq: Error starting jq: FileNotFoundError: [Errno 2] No such file or directory: 'jq': 'jq'. Is jq installed and available on PATH? 我的yaml文件没有调用jq,并且我的提交中确实有这个yaml文件。我可以执行which yq,当我执