python操作mysql

970阅读 0评论2013-02-27 niexining
分类:Python/Ruby


点击(此处)折叠或打开

  1. from conn import conn,c
  2. from draw import *
  3. from config import *
  4. import pyExcelerator

  5. sql = "SELECT DISTINCT km FROM %s WHERE station != '李官' and type = '变形' " %T_SENSOR
  6. count = c.execute(sql)

  7. print u'一共有%s行记录' %count

  8. result=c.fetchone()
  9. print result

  10. results=c.fetchmany(5)
  11. for r in results: print r

  12. print '=='*10
  13. c.scroll(0,mode='absolute')

  14. kms = c.fetchall()

上一篇:PHPlot曲线图
下一篇:没有了