Home  >  Article  >  Backend Development  >  How to set python color

How to set python color

little bottle
little bottleOriginal
2019-05-20 09:58:079332browse

When a friend is doing Python, he doesn’t know how to set the color. let me tell you! The character color of the Python terminal is controlled by escape sequences. It is a system display function in text mode and has nothing to do with the specific language.

How to set python color

The escape sequence starts with ESC, which is completed with \033 (the ASCII code of ESC is 27 in decimal and 033 in octal).

Grammar format:

Format: \033[Display mode; foreground color; background color m
Note: Since the values ​​representing the different meanings of the three parameters are all unique There are no duplicates, so there is no fixed requirement for the writing order of the three parameters, and the system can recognize them; however, it is recommended to follow the default format

Parameter meaning:

Display mode Meaning

0 terminal default settings

1 Highlight display

4 Use the next line

## 5 Flash

## 7 Anti -White Display

## 8 8 Invisible

Foreground Color Background Color Color

30 40 Black


31 41 Red

32 42 Green

33 43 Yellow

34              44                                                                                                                                                                                                                                                                           Blue         White

The above is the detailed content of How to set python color. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is python automationNext article:what is python automation