python下终端彩色print模拟黑客帝国进入电脑界面-爱心版
【python下终端彩色print模拟黑客帝国进入电脑界面-爱心版】1.图
文章插图
2.模拟彩图
文章插图
3.代码:
import random, time, osimport colorama#终端彩色设置 , 第1步:导出模块#终端彩色设置 , 第2步:定义colorama.init(autoreset = False)RED = colorama.Fore.RED + colorama.Style.BRIGHTCYAN = colorama.Fore.CYAN + colorama.Style.BRIGHTGREEN = colorama.Fore.GREEN + colorama.Style.BRIGHTYELLOW = colorama.Fore.YELLOW + colorama.Style.BRIGHTMAGENTA = 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')#粉红色=MAGENTAtime.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=0while i<500:#设置i , 定义500个charts , 否则进入死循环# 每次打印延时0.009秒time.sleep(0.009)print(*random.choices(charts, k=79))i+=1clear_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)**3if formula <= 0:lst_con += char[(x) % len(char)]else:lst_con += ' 'lst.append(lst_con)allChar += lstprint('\n'.join(allChar))time.sleep(0.5)
4.纯属娱乐和学习 , 特效而已 。
- 推新标准建新生态,下载超198亿次金山发力海内外
- 闲鱼|电诉宝:“闲鱼”网络欺诈成用户投诉热点 Q3获“不建议下单”评级
- 王兴称美团优选目前重点是建设核心能力;苏宁旗下云网万店融资60亿元;阿里小米拟增资居然之家|8点1氪 | 美团
- 先别|用了周冬雨的照片,我会成为下一个被告?自媒体创作者先别自乱阵脚
- 丹丹|福佑卡车创始人兼CEO单丹丹:数字领航 驶向下一个十年
- 看过明年的iPhone之后,现在下手的都哭了
- 砍单|iPhone12之后,拼多多又将iPhone12Pro拉下水
- 巨头|“社区薇娅”都不够用了 一线互联网巨头全员下场卖菜
- 余额|中兴通讯:现有资金余额仅能确保公司当前经营规模下现金流安全
- 销售|Shopify宣布创下51亿美元的假日购物季销售纪录