What I need to do is the following: in a Python script spawn, say the ls --colors=always / Linux command, and read its output. The important part of this is that I need the output to keep all the ANSI escape sequences (colors and such) to later translate these sequences into HTML. I heard that Python pty module can do that, but I could not find a useful example of its usage in the Internet, and this module’s documentation is not quite comprehensive. I’ll appreciate if someone could guide me through the way of accomplishing this task.
What I need to do is the following: in a Python script spawn, say
Share
Now all the data you want should be in
output– including the ANSI escape sequences.