我使用python和mySql,运行下面的查询:sSql="selectidfromtable_name"cursor.execute(sSql)lrec=self.cursor.fetchall()json.dumps(lrec)并收到一条错误消息,因为我返回的是longintnotation'id':1L而不是'id':1我发现解决这个问题的唯一方法是丑陋的:sSql="selectcast(idaschar(10))asidfromtable_name"有什么更好的方法吗?谢谢,于尔根 最佳答案 您可以遍历lrec并将所有id