Discuss / Python / help!mysql疑问

help!mysql疑问

Topic source

尧尧_tifosi

#1 Created at ... [Delete] [Delete and Lock User]

sql1='select trade from 3097test where date between ' sql2=' and ' sql3=' and workday=' sql4=' and time=' sql=sql1+stdate+sql2+enddate+sql3+str(workday)+sql4+time print(sql)

#以上都没问题,是我要的sql语句 cursor.execute(sql) ans2 = cursor.fetchall() print(ans2) 得到的结果是这样的: [(2252.0,), (2666.0,), (2014.0,), (1960.0,), (1890.0,), (1812.0,), (1909.0,), (1999.0,), (2030.0,), (2632.0,)]

怎样能得到(2252,2666,2014,1960,1890,1812,1909,1999,2030,2632)这样形式的结果啊?

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

map()


  • 1

Reply