I'm making a Python Syntax Highlighter and basically what it does is replaces keywords in the entered string with colored versions of the same string. Here's a sample of my code (the whole program is basically just copy+pasting this code)
from colorama import Fore
def highlight(text):
text = text.replace("print", "{}print{}".format(Fore.BLUE, Fore.RESET))
print(text)
But when I try to use the following code:
highlight("print hello world")
(NOTE: I didn't put brackets because this was simply a test) It just printed print hello world in the default color. How can I fix this?