Is it possible to get the value of a specific cell when using prettytable?
I have the following code to iterate through all rows of a simple table.
from prettytable import PrettyTable
table = PrettyTable(["Column 1", "Column 2", "Column 3"])
table.add_row(["A", "B", "C"])
table.add_row(["F", "O", "O"])
table.add_row(["B", "A", "R"])
for row in table:
print(row)
This example prints the following 3 tables:
+----------+----------+----------+
| Column 1 | Column 2 | Column 3 |
+----------+----------+----------+
| A | B | C |
+----------+----------+----------+
+----------+----------+----------+
| Column 1 | Column 2 | Column 3 |
+----------+----------+----------+
| F | O | O |
+----------+----------+----------+
+----------+----------+----------+
| Column 1 | Column 2 | Column 3 |
+----------+----------+----------+
| B | A | R |
+----------+----------+----------+
How is it possible to get only the value of Column 1
, Column 2
or Column 3
of a row?
A
orB
.