utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
# author: 'zkx'
# date: '2018/3/11'
# Desc:从数据库中导出数据到...excel数据表中
#已封装,可以直接使用,只需更改sql语句即可
import xlwt
import MySQLdb
def export(host,user,password,dbname,table_name...MySQLdb.connect(host,user,password,dbname,charset='utf8')
cursor = conn.cursor()
#时间戳相减,转换为时分秒 导出到...excel时间格式要统一("%Y-%m-%d %H:%i:%S"),不然导出到excel为null
#concat(floor((lasto/1000-first/1000)/3600),"小时",floor