以下查询选择日期,然后选择数据库中的三个值
db = MySQLdb.connect("host1","user","pass","db")
cursor = db.cursor()
cursor.execute("select report_date, ROUND(SUM(balance), 2) as 'Net', ROUND(SUM(short_mkt_value), 2) as 'Short', ROUND(SUM(int_balance ), 2) as 'Long' from intersum_recap where group_name = 'Carter' group by report_date order by report_date desc")
rows = cursor.fetchall()
for row in rows:
print row
当它返回日期时,它不会按照我的意愿返回2018-3-29,而是返回" datetime.date(2018,3,29)"
如何按照我的意愿以YYYY-MM-DD格式打印日期?