0

I want to print the series variable in bold and color it red after the user input is provided.

This is the code I am currently using...

series = console.input("Search [bold cyan]Series[/] :earth_asia:\n> ")
console.print('Searching for [bold red] $(series) [/]')

This is the actual output I see...

Search Series 
> sample
Searching for $(series) 

This is the output I am expecting...

Search Series 
> sample
Searching for sample
PCDSandwichMan
  • 1,964
  • 1
  • 12
  • 23

1 Answers1

0

You need to use f-string here:

from rich.console import Console

console = Console()

series = console.input("Search [bold cyan]Series[/] :earth_asia:\n> ")
console.print(f'Searching for [bold red] {series} [/]')

or you could do this:

console.print('Searching for [bold red] {} [/]'.format(series))
Rohith Nambiar
  • 2,957
  • 4
  • 17
  • 37