1.图
2.模拟彩图
3.代码:
import random, time, os
import colorama #终端彩色设置,第1步:导出模块
#终端彩色设置,第2步:定义
colorama.init(autoreset = False)
RED = colorama.Fore.RED colorama.Style.BRIGHT
CYAN = colorama.Fore.CYAN colorama.Style.BRIGHT
GREEN = colorama.Fore.GREEN colorama.Style.BRIGHT
YELLOW = colorama.Fore.YELLOW colorama.Style.BRIGHT
MAGENTA = colorama.Fore.MAGENTA colorama.Style.BRIGHT
# 清屏(跨平台的)
def clear_screen():
if os.sep == '/':
os.system('clear')
else:
os.system('cls')
# 模拟延时效果
# 终端彩色设置,第3步:在print的前面加颜色字母:如RED
#注意如果第一个print设置了特定的颜色后,之后的紧跟的print的颜色就是紧随ta的颜色,如果单独设置需要注明第3步
def delay_waiting(content, frequency):
print(RED '%s' % content, end='', flush=True)
for x in range(1, frequency):
time.sleep(1)
print(GREEN '.',end='', flush=True)
time.sleep(1)
print(GREEN ' OK.Succeeded!')
# 模拟登陆锡安主机
def login_haike():
clear_screen()
#delay_waiting('Warning!!Warning!!\nThe System is being compromised!!!!\nIt is connecting to Haike Host now,please wait!!', 10) #10个点(.)或者10秒
print(RED ' △ ! '*10)
delay_waiting('Warning!!Warning!!!', 4)
delay_waiting('The System is being compromised!!!!', 4)
delay_waiting('It is connecting to Haike Host now,please wait!!!!!', 4)
time.sleep(0.5)
print(MAGENTA 'enter username: Robot') #粉红色=MAGENTA
time.sleep(0.2)
print(MAGENTA 'enter password: ******')
time.sleep(0.2)
delay_waiting(GREEN 'logging in', 4)#3个点(.)或者3秒
time.sleep(0.7)
clear_screen()
print('Hello, Dear Robot! \nYou are good haike! So cool!! I am failure!')
time.sleep(1)
#
login_haike()
# 清屏
clear_screen()
# 创建一个包含了a-z,A-Z,0-9的字符集
charts = [*[chr(x) for x in range(65, 123) if x not in range(91, 97)], *map(str, range(10))]
# 死循环
i=0
while i<500: #设置i,定义500个charts,否则进入死循环
# 每次打印延时0.009秒
time.sleep(0.009)
print(*random.choices(charts, k=79))
i =1
clear_screen()
print('欢迎进入黑客帝国!!!!!')
print('*'*100)
print(MAGENTA '★'*100)
print(GREEN '*'*100)
# 打印菱形
s = '*'
rows=10 #定义rows=10比较好
for i in range(1, rows 1, 2):
print((s * i).center(rows))
for i in reversed(range(1, rows - 1, 2)):
print((s * i).center(rows))
time.sleep(0.5)
sentence = "Dear, I love you forever!"
for char in sentence.split():
allChar = []
for y in range(12, -12, -1):
lst = []
lst_con = ''
for x in range(-30, 30):
formula = ((x*0.05)**2 (y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3
if formula <= 0:
lst_con = char[(x) % len(char)]
else:
lst_con = ' '
lst.append(lst_con)
allChar = lst
print('\n'.join(allChar))
time.sleep(0.5)
4.纯属娱乐和学习,特效而已。