"Python" outputs different colors of text in the console

Source: Internet
Author: User

Today's program has a very strange problem, because the console output is very much, you want to focus on the problem, specifically, the console output red text.

So I searched the internet for this article: https://www.cnblogs.com/gongxr/p/7257966.html

It seems that the scheme and Nodejs in a very similar, so used, let me depressed is the text color has not changed.

Then search, found python2.x change the color of the method to 3.x bad use, 3.x to use Colorama

First you need to install PIP install Colorama

Usage examples:

Import Colorama  from Import  "Thequick brown fox jumps over the lazy dog"print(fore.red + text)  Print(back.green + text + style.reset_all)print(text)

Effect:

Thanks to the author of the 761,515,421 article here.

"Python" outputs different colors of text in the console

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.