Python mysqldouble获取int base 10的文本

2024-05-18 21:23:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从mysql接收双值。你知道吗

我有一个mysql表“fxvalues”结构

Y1 -DOUBLE
X1 -DOUBLE
X2 -DOUBLE
...
X8 - DOUBLE

然后我在python上运行这个代码

queryvals=("SELECT Y.col1 as Y1,X.col1 as X1,X.col2 as X2,X.col3 as X3,X.col4 as X4,X.col5 as X5,X.col6 as X6,X.col7 as X7,X.col8 as X8 from fxvalues as Y, (SELECT * from fxvalues where interfaz_id="+str(Y_interfaz_id)+
            " ) as X where Y.interfaz_id="+str(id)+" and Y.day=X.day and Y.year=X.year and Y.month=X.month and Y.hour=X.hour and Y.min=X.min");

cursor2 = cnx.cursor();                                                    
cursor2.execute(queryvals);

for (Y1,X1,X2,X3,X4,X5,X6,X7,X8) in cursor:                
    print("Start");
    #print(str(float(Y1))+"  "+str(float(X1))+"  "+str(float(X2)));


cursor2.close();

我在for (Y1....) in cursor收到此消息:

ValueError: invalid literal for int() with base 10: b'48.047454833984375'

有什么想法吗??你知道吗


Tags: andidforasfloatcursordoublex1

热门问题