A
Aaron Kunkle
i'm trying to display output from a linux command line program and i'm
getting a lot of junk.
i was told that pulling out escape sequences like this regex: \033[^;]*;
would do it but that doesnt catch them all. i'm seeing the little box
characters for instance.
the only way i've found thus far is this:
building the regex object:
regex = re.compile(r'\033[^;]*;')
then passing each line of output through this:
line = regex.sub("",line)
junk = line.translate(identity, string.printable)
line = line.translate(identity, junk)
i know there must be a better way!
is there a way to get a non-printable group of characters to search
for?
thanks,
aaron kunkle
getting a lot of junk.
i was told that pulling out escape sequences like this regex: \033[^;]*;
would do it but that doesnt catch them all. i'm seeing the little box
characters for instance.
the only way i've found thus far is this:
building the regex object:
regex = re.compile(r'\033[^;]*;')
then passing each line of output through this:
line = regex.sub("",line)
junk = line.translate(identity, string.printable)
line = line.translate(identity, junk)
i know there must be a better way!
is there a way to get a non-printable group of characters to search
for?
thanks,
aaron kunkle