-3
我试图用Python将图像插入到MySQL中。为什么我会得到预期的缩进块?
import mysql.connector
import base64
conn = mysql.connector.Connect(user="root",passwd="solomon",host="localhost",db="binarymanipulation",port="3306")
cursor =conn.cursor;
with open('/home/solomon/Downloads/javapic.jpeg', 'rb') as image:
cursor.execute('INSERT INTO images(id,size,image) VALUES('PYTHON',245,image) ')
conn.commit();
conn.close();
我在运行此代码时收到expected an indented block
。
我错过了什么?什么是正确的方式?
@GreenChili,请不要修复OP的缩进。你只是删除了这个问题。 –
@MorganThrapp是的,你是对的,回滚。 – CodeLikeBeaker
oh dang现在我需要再次大写我的答案:P(只是在开玩笑) –