python print 彩色
时间: 2023-08-28 22:23:20 浏览: 99
要在Python中使用print打印彩色文本,你可以使用ANSI转义码或使用第三方库如termcolor或Colorama。
使用ANSI转义码的方法如下所示:
print('\033<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python中打印彩色信息的方法](https://blog.csdn.net/hou09tian/article/details/130945294)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [在python终端中打印颜色的3中方式(python3经典编程案例)](https://blog.csdn.net/cui_yonghua/article/details/129751013)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文