Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the methods of using python cold knowledge print

Shulou Source: shulou.com Published: 2022-06-01 04:08:22 10月03日 Update

In this article, the editor introduces in detail "what are the methods for the use of python cold knowledge print", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what is the use of python cold knowledge print" article can help you solve your doubts.

Let's take a look.

Print ('This is a\ 033 [1bot 35m test\ 033 [0mcm') print ('This is a\ 033 [1x 32x 43m test\ 033 [0m height') print ('033 [1x 33x 46m This is a test!\ 033 [0m')

Yes, you may have found something. Yes, these words don't seem to be normal.

Let's see how to manipulate these rebellious strings.

Let's take a look at a wave of knowledge points.

Font color | background color | Color description

30 | 40 | Black

31 | 41 | Red

32 | 42 | Green

33 | 43 | pale color

34 | 44 | Blue

35 | 45 | fuchsia

36 | 46 | Cyan

37 | 47 | White

-

Display mode | effect

-

0 | default settings of terminal

1 | highlight

| 4 | use underscore |

5 | flashing

| 7 | display the reverse white, and swap the font color with the background color. |

8 | not visible

Writing format: beginning:\ 033 [display mode; foreground color; background color m output result:\ 033 [0m]

The part marked blue above is the fixed point.

Explanation:

The three parameters in the first part: display mode, foreground color, background color are optional parameters

You can write only one of them, and the parameter must end with m.

Because the values that represent the different meanings of the three parameters are unique and do not repeat, so

There is no fixed requirement for the writing order of the three parameters, and the system can identify all of them.

It is recommended to write according to the default format specification.

As for the ending, it can also be omitted (of course, the price of laziness is the green wave)

Therefore, it is recommended to standardize the coding. It is recommended that\ 033 [* begins and\ 033 [0m] ends.

Let's see what happens if we don't write the ending.

Print ('033 [1bot 32m python engineer') # aims to only green a row of print ('evolution, python engineering lion') # turns you green again

Let's see what happens if we don't write m.

Print ('\ 033 [5 * * 31 * * 46) is easy to get started with.

What happens to my output? yes, when you don't write m, you can't see what you want, and this part of the default format is not output.

You might as well try not to write m, not to write the ending and see what happens.

Finally, there is a limerick.

Print [033 [0m') print] [1bot 32x 45m python engineer] 033 [0m') print ('033 [135x 46m everyone loves python\ 033 [0m') print ('033 [5x 31x 46m) introduction is easy\ 033 [0m') print ('033 [7x 3240m progress requires efforts\ 033 [7m')

Read here, this article "what is the use of python cold knowledge print" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to pay attention to the industry information channel.

Tags: Knowledge parameters background part usage method three project suggestion beginning article mode format result blue color output content font scenery Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL MariaDB Xiaomi Redmi macOS