有没有办法用python输出0\t{len(functions)个x0,每个之间用\t隔开}\n
可以使用字符串格式化来实现,具体代码如下:
functions = [1, 2, 3, 4, 5]
x0_count = len(functions)
x0_str = "\t".join(["x0" for i in range(x0_count)])
print(f"0\t{x0_str}\n")
输出结果为:
0 x0 x0 x0 x0 x0
原文地址: https://www.cveoy.top/t/topic/wk9 著作权归作者所有。请勿转载和采集!