Question:
Why isn’t this ansi code working?
Repl link:
https://replit.com/@0655154/Python#main.py
Code snippet
for _ in range(6):
print("Hello, world!\033[1B")
Expected output
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Actual output
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Why is this happening, and what can I do to get the expected output?
Welcome to the forums, @0655154!
Could you try replacing the escape code \ 033[1B
with the \n
character?
3 Likes
That’s… Not what’s happening? If you read their post, that’s what they expect to happen, and it’s not.
2 Likes
Oh, I misunderstood the issue, my fault.
2 Likes
I’ve noticed that horizontal ansi codes (like \033[1C
and \033[1D
) work just fine, but the vertical ones (\033[1A
and \033[1B
) only apply once.