import binascii
with open('test.ico','rb') as f:
    print binascii.b2a_hex(f.read())

INSERT INTO `mysqltest1` VALUES (2,1.2131,’eqwd’,’eqwe’,’2019-01-21′,0x7465737474657374)

存放到mysql的大字段类型,转化成十六进制数据再插入