'ANSI background on only one space/ end the colour
I'm trying to change the background colour of a space (" ") to red using the ANSI escape sequence.
print('\u001b[41m')
This changes the background of the entire line to red. How can I make it stop after one space?
Solution 1:[1]
You can use rich to simplify how to send the sequences
from rich import print
print('[red reverse] [/red reverse]other text')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Diego Torres Milano |
