合并 python 打印语句

Combining python print statements

是否可以将以下两种说法合二为一?

print(colored(score,"green"),end=" ")
print(colored(tokens,"green"))

是的,只需将最后一项添加到第一个打印语句即可:

print(colored(score,"green"), colored(tokens,"green"))

因为它们都是绿色的,所以您可以组合这些字符串然后给它们着色:

output = '{} {}'.format(score, tokens)
print(colored(output, 'green'))