I would like to color elements in a numpy.ndarray, specifically ones which are of numpy.int64 type.
For example, how do I color each 1 in the following list, say, red?
L = [1,0,1,0,1]
I have tried using colorama. Here is my code. The result is also included.
from colorama import Fore, Back, Style
L = [i%2 for i in range(6)]
for i in L[::2]:
L[i] = Fore.RED + str(i)
print(L)
['\x1b[31m1', '\x1b[31m0', '\x1b[31m1', '\x1b[31m0', '\x1b[31m1']
As far I know we cannot store variables in list as colored variable. colorama only prints the variable in color. So your code will be