Is there a way to get a list from my DB?
I have this in my code:
graph_avg_session_duration = AnalyticsData.query.filter_by(name='graph_sessions').first()
item = graph_avg_session_duration.value
print(item)
The value in the DB is: [0, 0, 50, 52]
But when I check the type it says string but I need this to be type list.
I tried doing list(item)
but this just makes a list item every char so doesn't work.
Don't know about your DB, but if you want to convert that string into a list and each element is a integer* you could try this, without using libraries:
list( int(x) for x in item.replace('[', '').replace(']','').split(', '))
*integer could be replaced with float etc