I append items from a database to an array, like that (I need the 0 in front):
tmpArray = [0]
sql = "SELECT value FROM employees;"
c.execute(sql)
rows = c.fetchall()
for row in rows:
tmpArray.append([row[0]])
Output is like that:
tmpArray = [0, ["xxx"], ["yyy"], ["zzz"]]
I need the Array surrounded by brackets like that:
tmpArray = [(0, ["xxx"], ["yyy"], ["zzz"])]
How can I achieve this or how can I modify the current array, so I get the result that I want? Thank you for helping. The script that I want to use needs the data exactly like that.
tuple(xs)will convert any list (or rather, iterable)xsto a tuple.