Python 3.x 如何将sql查询转换为列表?

Python 3.x 如何将sql查询转换为列表?,python-3.x,list,Python 3.x,List,我试图将我的sql查询输出转换为一个列表,以便以某种方式显示 这是我的密码: def get_sf_metadata(): import sqlite3 #Tables I want to be dynamically created table_names=['AcceptedEventRelation','Asset', 'Book'] #SQLIte Connection conn = sqlite3.connect('aaa_test.db')

我试图将我的sql查询输出转换为一个列表,以便以某种方式显示

这是我的密码:

def get_sf_metadata():

    import sqlite3
    #Tables I want to be dynamically created
    table_names=['AcceptedEventRelation','Asset', 'Book']

    #SQLIte Connection
    conn = sqlite3.connect('aaa_test.db')
    c = conn.cursor()

    #select the metadata table records
    c.execute("select  name, type from sf_field_metadata1  limit 10 ")
    print(list(c))


get_sf_metadata()
以下是我的输出:

[('Id', 'id'), ('RelationId', 'reference'), ('EventId', 'reference')]
有没有办法使输出看起来像这样:

[Id id, RelationId reference, EventId  reference]
你可以试试

print(["{} {}".format(i[0], i[1]) for i in list(c)])
那会把你打印出来

['Id id', 'RelationId reference', 'EventId reference']

我的英雄,我的救世主