Method: rich.console.Console.save_text
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
'/var/folders/yp/qx0crmvd4sbck7chb52sws500000gn/T/tmp_kafsfwy/rich.txt' (1)
True (1)
False (1)
1def save_text(self, path: str, *, clear: bool = True, styles: bool = False) -> None:
2 """Generate text from console and save to a given location (requires record=True argument in constructor).
3
4 Args:
5 path (str): Path to write text files.
6 clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
7 styles (bool, optional): If ``True``, ansi style codes will be included. ``False`` for plain text.
8 Defaults to ``False``.
9
10 """
11 text = self.export_text(clear=clear, styles=styles)
12 with open(path, "wt", encoding="utf-8") as write_file:
13 write_file.write(text)