As long as I know, there are only five data types that can be set to columns in a sqlite3 table. They are:
nullmeans no data.integermeans a whole number.realmeans a float.textmeans any string.bloba binary data field in which you can store files, documents, images.
But currently, I have a list called self. inventory in my code, that gets items added into it occasionally when users' do something specific. That is not the issue. My problem is that what data type should I assign to the list that I want to store in the table? Or is there any other method I can use to store the values of the table into the db. Currently, here is my connection, cursor and table execution:
connection = sqlite3.connect('db_of_game.db')
cursor = connection.cursor()
cursor.execute(
'CREATE TABLE user_data(user_name text primary key, money integer, inventory <What data type to use here?>, deposited integer, allowed_deposit integer)'
)
connection.commit()
connection.close()
"item1,item2,item3") and use thetexttype, then use.split(",")to get the list back when reading from the database.list.split(","). This will turn the comma separated string into a python list.