How could I erase a row table in rich? (Erase the rows or reset all the table)
ex. How could I reset tableTest or erase a row?
JavaScript
x
17
17
1
from rich.console import Console
2
from rich.table import Table
3
4
tableTest = Table(title="Star Wars Movies")
5
6
tableTest.add_column("Released", justify="right", style="cyan", no_wrap=True)
7
tableTest.add_column("Title", style="magenta")
8
tableTest.add_column("Box Office", justify="right", style="green")
9
10
tableTest.add_row("Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$952,110,690")
11
tableTest.add_row("May 25, 2018", "Solo: A Star Wars Story", "$393,151,347")
12
tableTest.add_row("Dec 15, 2017", "Star Wars Ep. V111: The Last Jedi", "$1,332,539,889")
13
tableTest.add_row("Dec 16, 2016", "Rogue One: A Star Wars Story", "$1,332,439,889")
14
15
console = Console()
16
console.print(tableTest)
17
Advertisement
Answer
No, rich does not provide any APIs to Delete/Remove the rows. See this Support for deleting/removing rows/columns from table to understand why no such APIs are added to the Table
class.