hello world

Python生成类似于黑客满屏二进制界面

平常看到一些黑客的书籍或图片,界面上都有大量的随机0和1,空白等图,于是用python来模拟一下这个假界面。纯属搞笑,没什么特别作用。

#-*- encoding=utf-8 -*-
#
import os
import random
import time

def getline():
    width = os.get_terminal_size().columns
    data = list('10 ')
    line = ''
    while len(line) < width:
        line += random.choice(data)
    return line

while True:
    print(getline())
    time.sleep(0.2)

每0.2秒屏幕会刷一行随机的0,1和空白的组合,效果如下:

 

posted @ 2021-11-26 21:33  浩天四哥  阅读(290)  评论(0)    收藏  举报