fabiodurgante Posted November 23, 2020 at 12:55 PM Report Share #620306 Posted November 23, 2020 at 12:55 PM ola tenho seguinte tamanho = len(lista) while True: print(colored(CYAN.format(strftime('%d/%m/%Y'))),colored(CYAN.format(strftime("%H:%M:%S"))),colored(CYAN.format('<-> '))), end="", flush=True) print("\r", end="", flush=True) assim escreve data e hora sempre na mesma linha segundo por segundo, quero escrever ate tamanho da lista depois que atigir tamanho da lista sobrepor o print eemplo 23/11/2020 09:53:20 23/11/2020 09:53:21 agora comecar a sobrerpor digamos que tamanho da lista seja 2 sobrepor aora imprime 2 vezes e depois sobrepor 23/11/2020 09:53:22 23/11/2020 09:53:23 Link to comment Share on other sites More sharing options...
maluco-123 Posted November 23, 2020 at 11:06 PM Report Share #620320 Posted November 23, 2020 at 11:06 PM Boas, Basicamente tens de mover o "cursor" para a "primeira" linha. Se estiveres em Linux é simples, é só uma "escape sequence", se estiveres em Windows, começa a usar linux, isto é, é mais difícil. Para referência: https://rosettacode.org/wiki/Terminal_control/Cursor_positioning#Python def move_cursor(x, y): print("\033[%d;%dH" % (x,y), end="", flush=True) Força aí Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now