我尝试打印 3 列:
- 艺术家.艺术家
- 歌曲.歌曲
- 歌曲.views
这是我的代码:
conn = sqlite3.connect('utube.db')
conn.row_factory = lambda cursor, row: row[0]
c = conn.cursor()
c.execute("""Select Artists.artist, Songs.Song ,Songs.views FROM Songs
INNER JOIN Artists
ON Artists.Artist_Id = Songs.Artist_Id
""")
allsong = c.fetchall()
a = allsong
print(a)
conn.commit()
conn.close()
但输出仅返回Artists.artist
.
['Blackpink', 'Blackpink', 'Lady gaga', 'Lady gaga', 'Lady gaga', 'The Beatles', 'The Beatles', 'Metallica', 'Frank Sinatra', 'Frank Ocean']
如何解决它以使其返回类似
[['Blackpink',?,?],['Blackpink',?,?],['Lady Gaga' ,?,?]........]