Skip to content
Advertisement

Python: How can I make the ANSI escape codes to work also in Windows?

If I run this in python under linux it works:

JavaScript

But if I run it in Windows it doesn’t work, how can I make the ANSI escape codes work also on Windows?

Advertisement

Answer

For windows, calling os.system("") makes the ANSI escape sequence get processed correctly:

JavaScript
Advertisement