gpt4 book ai didi

python - 在 Python 3.2 中更改单个打印行的颜色?

转载 作者:太空狗 更新时间:2023-10-30 00:20:13 25 4
gpt4 key购买 nike

<分区>

我在学习 Python 3.2 的过程中进行了一次基于文本的小冒险,目的是练习并更加熟悉这门语言。无论如何,我想让它在某些 Action 发生时,打印文本的颜色发生变化。我该怎么做。

例如,我希望出现这种情况的第一个文本是:

if 'strength' in uniqueskill.lower():
time.sleep(3)
print('As you are a Warrior, I shall supply you with the most basic tools every Warrior needs.')
time.sleep(3)
print('A sword and shield.')
time.sleep(1)
print('You have gained A SWORD AND SHIELD!')

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com