sql - Python: PSQL: Generate list from query -


i trying retrieve data table , output list. problem resulting list not in correct form.

this table: enter image description here

my code:

cur.execute("select tegebruikentags tagstegebruiken wel_niet_lezen = true") taglist = cur.fetchall() print (taglist) 

the output:

[('bakkerij.device1.db100int0',), ('bakkerij.device1.db100int4',), ('bakkerij.device1.db100int8',)]

the desired output:

['bakkerij.device1.db100int0', 'bakkerij.device1.db100int4', 'bakkerij.device1.db100int8']

how should edit code in order list want?

thanks in advance!

i'm not sure if can automatically query, solution.

li = [item[0] item in cur.fetchall()] print li '['bakkerij.device1.db100int0', 'bakkerij.device1.db100int4', 'bakkerij.device1.db100int8']' 

Comments