1 回答

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個(gè)贊
嗯,調(diào)用外部求解器可能會(huì)凍結(jié)該過程。
鑒于您可以使用 elixir 執(zhí)行 bash 腳本,您可以輕松地將 python 腳本更改為命令行可執(zhí)行文件(我建議單擊)。然后,您可以將輸出寫入.json
或.csv
文件,并在完成后使用 Elixir 將其讀回。
@click.group()
def cli():
? ? pass
@cli.command()
@click.argument('products_json', help='your array of products')
@click.argument('diet_json', help='your dietary wishes')
@click.option('--lower-bound', default=0, help='your minimum number of desired calories')
@click.option('--upper-bound', default=100, help='your maximum number of desired calories')
@click.option('--enhance', default=False, help="whether you'd like to experience our enhanced experience")
def calculate_meal_4(products_json, diet_json, lower_boundary, upper_boundary, enhance):
? ? pass
if __name__ == '__main__':
? ? cli()
然后您可以使用python3 my_file.py <products_json> <diet_json> ...
等等來調(diào)用它。
您甚至可以驗(yàn)證 JSON,然后直接返回解析后的數(shù)據(jù)。
添加回答
舉報(bào)