角标增加参数cursor=pymysql.cursors.DictCursor conn = pymysql.connect(**MYSQL_INFO) cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
结果示例:
[{'happened_type': 'REWARD', 'happened_info': '', 'recording_time': datetime.datetime(2022, 4, 27, 11, 45, 10)}, {'happened_type': 'PUNISH', 'happened_info': '与同学产生口角并动手打架', 'recording_time': datetime.datetime(2022, 4, 1, 11, 46, 16)}, {'happened_type': 'ASK_LEAVE', 'happened_info': '嗓子不舒服,请假一天休息', 'recording_time': datetime.datetime(2022, 4, 12, 12, 29, 35)}]