For some reason I end up with having a "list within a list" which does not really make sense to me:
I got a variable which contains the following output:
>>> print(combined_result)
>>> [[('id1', 'titel1'), ('id2', 'titel2'), ('id3', 'titel3'), ('id3', 'titel4')]]
which is generated by the following code:
combined_result = []
def executequery(cursor):
cursor.execute("SELECT id, title FROM database")
records = cursor.fetchall()
result = records
combined_result.append(result)
return
To actually get the first element of that combined list I call it with:
>>> print(combined_result[0][1])
>>> ('id1', 'titel1')
I am wondering whether this is the right way to do it? Or should I modify my code? It is a bit weird right to have a list within a list in my situation?