import sqlite3
conn= sqlite3.connect('Pictures.db')
cur=conn.cursor()
cur.execute('create table pictures(thebin blob)')
file = open('logo4.png', 'rb')
cur.execute('insert into pictures(thebin) values (?)',
[sqlite3.Binary(file.read())])
cur.execute('select thebin from pictures')
file = cur.fetchone()
print(file)
conn.commit()
执行代码后,我将输出作为
[(B'\ x89PNG \ r \ n \ X1A \ n \ X00 \ X00 \ X00 \ rIHDR \ X00 \ X00 \ X07 \ X80 \ X00 \ X00 \ x048 \ X08 \ X02 ..]
而不是显示图像。
谁能告诉我哪里出错?