+ 1

How to Color a word in a string. PYTHON 3

I want to color some words from a string, for example: str = "this is my string, is good"; If the user's input is "is", I want to print the whole str again, but with the "is" colored, for example, the first "is" is colored with red and the second "is" is colored with green, but I don't know how to do it... Is there a way to do it? can I use coloroma to achieve this?

9th May 2018, 6:50 PM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
2 Respuestas
+ 1
most console outputs just have one set font color. you might be able to import some graphic libraries and then use those, but i'm not too familiar with it.
9th May 2018, 7:12 PM
hinanawi
hinanawi - avatar
0
Jan Markus I tried to use, but it doesn't work in python 3... :(
10th May 2018, 4:57 PM
Eduardo Perez Regin
Eduardo Perez Regin - avatar