You can print text in green color in Python by using ANSI escape codes.
Here's an example:
main.py65 chars2 lines
In the above code, \033[32m
represents the ANSI escape code for green color and \033[0m
is used to reset the color back to the default color.
You can also define a function to make it easier to print colored text:
main.py116 chars5 lines
This will print the text in green color.
gistlibby LogSnag