0

Outut of the stdout: This is the output of the Stdout, after the command is executed.But I am unable to remove the ANsi Characters at all. The output is something is like this:

[2J[m
]0;c:\windows\system32\cmd.exeMicrosoft Windows [Version 10.0.17763.805][38X[38C
(c) 2018 Microsoft Corporation. All rights reserved.[28X[28C
[80X[80C
administrator@ANU-NW C:\Users\Administrator>[36X[36C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C
[80X[80C]0;Administrator: c:\windows\system32\cmd.exe

I tried the below, regex:

 ansi_regex = re.compile(r'\*\[[0-9]*[ABCDEFGJKPSTLMXdsum]|\[[0-9;]* 
     [Hf]|\[[\?]*[125]{2}[hl]{1}')

But it doesnt work.Anyhelp, greatly appreciated.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
simi
  • 21
  • 4
  • Can you please provide some context? What does the output look like exactly? – mapf May 04 '20 at 09:10
  • 2
    Duplicate of [How can I remove the ANSI escape sequences from a string in python](https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python) – Jongware May 04 '20 at 09:14
  • But i searched the entire, ASCI TAble, but couldnot find, what [80X[80C mean? – simi May 04 '20 at 13:39

0 Answers0