Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在这段代码中,它使字符串 'hello' 变为红色:
from termcolor import colored a = colored('hello', 'red') print(a)
有没有办法让变量变成一个没有颜色的普通字符串?
删除字符串的第一个和最后 4 个字符应该删除颜色信息。例如:
from termcolor import colored a = colored('hello', 'red') print(a) b = a[5:-4] print(b)