问题描述
我希望当您使用help()函数时弹出的整个文本受到所用颜色代码的影响,但是,当我运行脚本时,唯一受所述颜色代码影响的部分是help()结果下方的“无”文字
print(f'\033[34m {help("for")} \033[m')
This is the single line of code and how it looks in the terminal
解决方法
我发现的(非常简单)的解决方法是将颜色代码打印在单独的行上
示例:
print('\033[41m')
print(help('for'))
print('\033[m')
该代码将使该代码生效,因此help('for')函数的输出具有红色背景