Ejemplo 1: efecto de escritura en Python
from time import sleep
import sys
string = "The Battle Cats For Life" # Whatever string you want
for letter in string:
sleep(0.01) # In seconds
sys.stdout.write(letter)
sys.stdout.flush()
Ejemplo 2: efecto de máquina de escribir python
import sys
import time
st = 0.07 # How fast you want the time in between letters to be (stands for "sleep time"
def sp(str)
for letter in str:
sys.stdout.write(letter)
sys.stdout.flush()
time.sleep(st)
print()
# Using it
sp("Your text goes here!")
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)