【发布时间】:2021-09-13 02:00:33
【问题描述】:
也许你们中的一些人知道并且关于 shell 脚本 - tput 是实用程序使用 terminfo 数据库来使 shell 可以使用终端相关功能的值和信息
在我的 python 脚本中,我有以下示例:(只是长代码中的一个示例)
for TOPIC in list:
if str(val) in TOPIC:
word = TOPIC.split()[1]
print ("Topic " + word + " is successfully configured")
else:
try:
word = TOPIC.split()[1]
print ("Topic " + word + " bad configuration")
except IndexError:
pass
我想将以下印刷的颜色从白色改为绿色:
print ("Topic " + word + " is successfully configured")
或将颜色从白色更改为红色:
print ("Topic " + word + " bad configuration")
是否可以像在bash 脚本中那样更改python3 中的颜色?
【问题讨论】:
-
查看this question 寻求帮助。
标签: python python-3.x linux tput