Как удалить escape-последовательности ANSI из строки в PythonPython

Программы на Python
Anonymous
Как удалить escape-последовательности ANSI из строки в Python

Сообщение Anonymous »

Here is a snippet that includes my string.
'ls\r\n\x1b[00m\x1b[01;31mexamplefile.zip\x1b[00m\r\n\x1b[01;31m' The string was returned from an SSH command that I executed. I can't use the string in its current state because it contains ANSI standardized escape sequences. How can I programmatically remove the escape sequences so that the only part of the string remaining is 'examplefile.zip'.


Источник: https://stackoverflow.com/questions/146 ... -in-python

Вернуться в «Python»