2 ms·
With judicious use of VT100 codes and sleep(), you can do animation as well: #!/usr/bin/env python3 from time import sleep def width(): wh
by Joker_vD 3y ago
With judicious use of VT100 codes and sleep(), you can do animation as well:
#!/usr/bin/env python3
from time import sleep
def width():
while True:
yield from range(3, 11)
yield from range(9, 1, -1)
print('(\\___/)\n(>O.o<)\n(>[||]<)\n(")_(")')
for w in width():
l = '(>[' + w * '|' + ']<)'
print(f'\x1b7\x1b[2A\x1b[K{l}\x1b8', end='', flush=True)
sleep(0.1)