- my CSDN Home page
- My Python Study personal memos
- my HOT Bo
Python lewd
Code running effect
Home
“ User input , It's all unreliable ”
#!/usr/bin/nve python # Linux The script interpreter path specifies the comment .
# coding: utf-8 # Code description of this script .
def color(s = ' Characters to be colored ', \
fg_color = 'black', bg_color = 'black', \
effect = 'default'):
colors = {
'black': 0,
'red': 1,
'green': 2,
'yellow': 3,
'blue': 4,
'purple': 5,
'cyan':6,
'gray': 7,
'default': 0,
'light': 1,
'unline': 4,
'flicker': 5,
'rewhite': 7
}
fg_color = colors.get(fg_color)
bg_colir = colors.get(bg_color)
effect = colors.get(effect)
s = f'\033[{effect};3{fg_color};4{bg_color}m{s}\033[0m'
print('\n\n', s)
return s
print(color(' Example ', 'red', 'green', 'light'))
print('\n\n', '\033[1;32;41m Python lewd \033[0m')
def colors_table():
s = f''' Python \033[1;31;40m Colorimeter \033[0m Print '''
print(f'\n\n\n{
s:_^60}\n\n\n\
{
"0 " :>12} Terminal default settings \n\
\n\n\n{
"The End":_^50}\n')
colors_table()
''' 1 Highlight 4 Use underline 5 flashing 7 On the contrary ----------------------- 30 Black foreground 31 Red foreground 32 Green prospect 33 Yellow foreground 34 Blue foreground 35 Purple foreground 36 Cyan foreground 37 Gray foreground ----------------------- 40 Black background 41 Red background 42 Green background 43 Yellow background 44 Blue background 45 Purple background 46 Blue background 47 Grey background '''
( If you can't make clear the function from the statement annotation , Please leave a message in the comment area for advice and discussion .)
Home
my HOT Bo :
- “ Happy number ” Judge ( Current reading 1171)
- Roman digital converter ( Using Roman numerals to construct the value modulus of elements to realize )( Current reading 1526)
- Roman digital converter | Roman numeral generator ( Current reading 1998)
- Hot: Give Way QQ Magic code of group nickname color change ( Current reading 4326)
- Fibonacci sequence ( Recursive implementation and for Realization )( Current reading 2107)
- Find the repeated start and end positions of elements in the sorting array ( Current reading 1205)
- The largest rectangle in the histogram ( Current reading 1608)
- The letter combination of the telephone dialing keyboard ( Current reading 1227)
- Password strength detector ( Current reading 1671)
- Find the balance point of the list ( Current reading 1705)
- String statistics ( Current reading 2179)
- Nim game ( Code optimized version )( Current reading 826)
- Nim game ( Smart version starts )( Current reading 3248)
Recommended conditions Click to read a thousand
Reference article :
Last one :
Next :
A good writer recommends : Good habits of reliable programmers
Home
Excellent articles :
- OPP The three major characteristics : In the package property
- Understand through built-in objects python'
- Regular expressions
- python in “*” The role of
- Python A complete self-study manual
- Walrus operators
- Python Medium `!=` And `is not` Different
- The right way to learn programming
source : Laoqi classroom
CSDN Practical skills blog :
- 8 A good one Python Practical skills
- python Ignore the warning