Added strip_colors() function

This commit is contained in:
2Shirt 2018-12-10 19:19:35 -07:00
parent 2b43cdf9e2
commit a2ef06e6db
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -515,6 +515,12 @@ def stay_awake():
print_error('ERROR: No caffeine available.')
print_warning('Please set the power setting to High Performance.')
def strip_colors(s):
"""Remove all ASCII color escapes from string, returns str."""
for c in COLORS.values():
s = s.replace(c, '')
return s
def get_exception(s):
"""Get exception by name, returns Exception object."""
try: