Yes, the code you have there uses VT100 Escape Codes (note that \033 is the octal representation of character 27=escape. You could also use the hexadecimal \x1b instead), see http://en.wikipedia.org/wiki/ANSI_escape_code
These require a terminal emulator that supports VT100, which almost all linux terminal emulators do. Windows Command Prompt doesn't support them by default, but at the bottom of https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences there is some code that shows how to turn that on (it's only a few lines of additional code that you only need to run once at the beginning - I would put it into an #ifdef __WIN32 #endif for platform independence.)
I haven't actually tried that though and I'm not sure on which versions of windows it works.
Regarding python: python doesn't natively support VT100 either, but the colorama package https://pypi.org/project/colorama/ enables them (to my knowledge, it replaces the print or write methods with something that extracts the escape codes and does the manipulations via calls to kernel32.dll methods).