我正在使用Python 2.7并连接到DB2 Z / OS db 我写入csv的输出格式不正确,例如,timestamp观察包含在datetime.datetime()中,小数用decimal()包装,char / varchar观察用u'开头。不知道如何解决问题,任何想法? -Thanks
opfile = open('dump.csv','w')
dump_writer = csv.writer(opfile)
ibm_db_conn = ibm_db.connect(conStrg,"","")
conn = ibm_db_dbi.Connection(ibm_db_conn)
cursor = conn.cursor()
cursor.execute(sql)
data = cursor.fetchall()
for row in data:
dump_writer.writerow([row])