How to make random characters and numbers appear a

2019-09-24 17:12发布

How do I make random characters and numbers appear all over the screen perfectly, from up to down like an animation? With details, it should start with the first ever line (not necessarily a line, it can be byte by byte) in the console's window, fill it up with random characters and numbers, delay the screen probably with milliseconds because it's an animation and pass to the other line repeating the same process until it reaches the last line of the console, in Python. I tried to look it up since I don't know how to do it and came up with no results at all, I want it for a program I'm making to give it some nice loading screen or so.

1条回答
Explosion°爆炸
2楼-- · 2019-09-24 17:52

You can activate your program via the command prompt and then write this block of code in python:

import random
import shutil

columns, rows = shutil.get_terminal_size(fallback=(80, 24))
size_of_console = columns * rows

for i in range (size_of_console):
    print(chr(random.randint(33, 126)), end = '')

make sure you have the right libraries installed and you are good to go! If you have further questions I would love to help!

查看更多
登录 后发表回答