"Learning God-rhel7" color processing in P5-python

Source: Internet
Author: User
Tags clear screen echo display

What this section says:

Job Script

Homework:
Combat: Create a product page that requires
1, display the commodity name and price correspondence relation
2. Get the user's salary level
3, to provide users with the option to buy products function
4, users buy finished goods, display user account balance
5, prompt the user whether to continue to purchase

Color processing

Shell echo Display in script with color display, echo display with color, need to use parameter-e

The format is as follows:

echo-e "\033[ Word background color; text color m string \033[0m"

Cases:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/79/A0/wKiom1aWYW7h-DlRAABgltSXYJY678.png "title=" 3.png " alt= "Wkiom1awyw7h-dlraabgltsxyjy678.png"/>

Where 42 of the position represents the background, 31 of the position represents the color of the word, 0m is clear all formats

Note:

1, the word background color and the text color is in English ";"

2. There is a m behind the text color

3, before and after the string can have no space, if any, the output is also a space

Here is the corresponding word and background color, you can try to find out the different color collocation

The color of the word

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/79/9E/wKioL1aWYW6zWTANAAJWwOvLQ6E566.png "title=" 2.png " alt= "Wkiol1awyw6zwtanaajwwovlq6e566.png"/>

Background

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/79/A0/wKiom1aWYSjg8ss_AAJmzLEImOI667.png "title=" 1.png " alt= "Wkiom1awysjg8ss_aajmzleimoi667.png"/>

Last Face Control option description

\33[0m Close All Properties

\33[1m Setting High brightness

\33[4m Underline

\33[5m Flashing

\33[7M Reverse Display

\33[8m blanking

\33[30m-\33[37m Setting the foreground color

\33[40m-\33[47m Setting the background color

\33[na the cursor to move n rows

\33[NB cursor down n rows

\33[NC cursor right shifts n rows

\33[nd cursor left n rows

\33[Y;XH Setting the cursor position

\33[2J Clear Screen

\33[k clears the contents from the cursor to the end of the line

\33[s Save Cursor position

\33[u Restore cursor Position

\33[?25l Hide Cursor

\33[?25h display cursor

Python Medium Color Management

#!/usr/bin/env python

#coding =utf-8

game = ' League of Legends '

print ' \033[41;34m%s\033[0m '% game

print ' League of Legends '

[[Email protected] ~] #python alliance.py

League of Legends

League of Legends

Please leave a message if you have any questions during the learning process. For more information, please add:
Learning God It-linux Lecturer-RM Teacher qq:2805537762
Learn God it-teacher qq:3341251313
Learn God it-Xu Bin qq:372469347
Learn God it education RHEL7 Exchange Group: 468845589


This article is from the "Learn God IT Education-instructor Mk" blog, please be sure to keep this source http://xuegodlinux.blog.51cto.com/10844319/1734806

"Learning God-rhel7" color processing in P5-python

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.