I have created a table using SQLAlchemy with Python+Flask.
Let us call this table Table.
In table I have columns called Col_1, Col_2,....Col_n.
Is it possible for a given row to access the values in these columns in a for loop.
Here is what I tried:
row = Table.query.get(1) #returns the first row
for i in range(1, n+1):
print(row.col_i)
But it throws an error that the attribute row_i does not exist.
How can I tell python that I want it to pull the value in col_i not search for the attribute col_i explicitly as this does not exist.
print(row.col_ + i)Hope help you.