如何根据输入扩展 ASCII 框的大小?

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

我正在用 Python 制作一些涉及 ASCII 艺术的东西。使用格式打印,我试图将变量打印到框中,并且所述变量的名称每次都会不同。我将如何确保盒子根据变量的名称进行自我调整?

if t1HomeAdvantage:
            print(IGreen + """
            {} has the home advantage! """.format(round1Teams[0]) + ICyan + """
            ╔═══════════════════════════╦═══════════════════════════╗
            ║ {}  {}                    ║ {}  {}                    ║
            ╚═══════════════════════════╩═══════════════════════════╝
            """.format(round1Teams[0], t1Score, round1Teams[1], t2Score))

我还没有尝试过任何东西,因为我真的不确定如何去做。

python printing ascii ascii-art
© www.soinside.com 2019 - 2024. All rights reserved.