Method: rich.console.Console.capture
Calls: 20, Exceptions: 0, Paths: 1Back
Path 1: 20 calls (1.0)
Capture (20)
1def capture(self) -> Capture:
2 """A context manager to *capture* the result of print() or log() in a string,
3 rather than writing it to the console.
4
5 Example:
6 >>> from rich.console import Console
7 >>> console = Console()
8 >>> with console.capture() as capture:
9 ... console.print("[bold magenta]Hello World[/]")
10 >>> print(capture.get())
11
12 Returns:
13 Capture: Context manager with disables writing to the terminal.
14 """
15 capture = Capture(self)
16 return capture