Reputation: 525
I imported a table from a database by using sqlite3, and then converted it to a list, even the type() function returned that the class was a list, but it still gave me that error message when I tried to change one of the cells
Here's my code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
c.execute("SELECT * FROM table1")
table = list(c.fetchall())
print(type(table))
table[0][0] = '10'
Output:
<class 'list'>
Traceback (most recent call last):
File "PATH", line 9, in <module>
table[0][0] = '10'
TypeError: 'tuple' object does not support item assignment
Can anyone please tell me what's wrong?
Upvotes: 0
Views: 2238