Python 使用多个用户创建的函数以表格格式格式化函数的输出

问题描述 投票:0回答:0

我做了四个不同的函数pretty_print_int、make_field、make_line和simululate_infections。我想使用其他三个函数以表格格式输出 simulate_infections 的结果。我不确定 python 中的哪些函数可以这样做。我尝试了多种方法,但没有得到我想要的结果。目标是创建一个新函数来获取输出。

simulate_infections

the three formatting functions. ignore pretty_print_dollars

desired output

我将感染函数的结果保存为一个变量,并尝试将该结果作为参数传递给其他函数,但每次都会出错。我一次只试了一个。

python function format tabular
© www.soinside.com 2019 - 2024. All rights reserved.