Python Learning-terminal font highlighting

Source: Internet
Author: User

Implementation process:

The character color of terminal is controlled by escape sequence, and it is the system display function in text mode, which is independent of the specific language.

The escape sequence begins with the ESC, which is done with \033 (the ASCII code for ESC is 27 in decimal notation, or 033 in octal).

Format:

opening Section :\033[display mode, foreground color, background colour m + End part:\033[0m

Note: the first part of the three parameters: Display mode, foreground color, background color is an optional parameter, you can write only one of them, in addition, because the three parameters of the different meaning of the values are unique and no duplicates, so the three parameters of the writing sequence is not fixed requirements, System can be recognized, however, it is recommended to write in the default format specification. for the end part, can also be omitted, but in order to write the specification, it is suggested \033[*** beginning, \033[0m end. The meaning of the numeric parameter representation:
--------------------------------------------------------------------------------------Font Color| Background Color |Color Description-------------------------------------------       | 40 |Black| 41 |Red| 42 |Green| 43 |Yellow color| 44 |Blue| 45 |Purplish Red| 46 |Cyan Blue| 47 |White--------------------------------------------------------------------------display Mode|effect-------------------------------          |Terminal default Settings|Highlight Display|Use underline|flashing|anti-white display|not visible-------------------------------

Example:

Print ('\033[1;31;40m the account and password you entered is wrong! \033[0m')

Output: The account number and password you entered are incorrect!

Reference: https://www.cnblogs.com/hellojesson/p/5961570.html


Python Learning-terminal font highlighting

Related Article

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.