18 lines
436 B
Python
18 lines
436 B
Python
import re
|
|
|
|
class Utils():
|
|
|
|
# remove ANSI escape sequences from string
|
|
@staticmethod
|
|
def remove_ansi(string):
|
|
ansi_escape = re.compile(r'\x1b[^m]*m')
|
|
return ansi_escape.sub('', string)
|
|
|
|
# removes ANSI escape sequences from a list of strings
|
|
@staticmethod
|
|
def remove_ansi_from_list(l):
|
|
for index, element in enumerate(l):
|
|
l[index] = Utils.remove_ansi(element)
|
|
|
|
return l
|