所以我正在ubuntu上做一个python3项目,我需要彩色文本,通过google的快速搜索,我发现bcolors做了我需要的事情。唯一的问题是,当我把它和
input()
它从不换行,只是在上面写。
这是b颜色:
class bcolors:
purple = '\033[95m'
blue = '\033[94m'
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
cyan = '\033[96m'
white = '\033[97m'
grey = '\033[90m'
end = '\033[0m'
bold = '\033[1m'
underline = '\033[4m'
例子:
输入
while True:
x = input('{}input {}'.format(bcolors.green, bcolors.end))
print(x)
当第一行空间不足时:
oddut it is really odd it is really odd it is really odd it is really
而不是
input it is really odd it is really odd it is really odd it is really it is really odd
有人知道怎么解决这个问题吗?