highlight text python code example
Example: higlight words in python
from functools import reduce
from itertools import chain
text = 'left foot right foot left foot right. Feet in the day, feet at night.'
l1 = ['foot','feet']
print(reduce(lambda t, x: t.replace(*x), chain([text.lower()], ((t, colored(t,'white','on_red')) for t in l1))))