django框架学习:十四.django 查询结果转json (11)

[{"user_name": "liushui", "psw": "123456", "mail": "123456@163.com"}, {"user_name": "liushui0", "psw": "12345", "mail": "123@qq.com"}, {"user_name": "liushui1", "psw": "123", "mail": "123456@qq.com"}, {"user_name": "liushui11", "psw": "123456", "mail": "897564"}]

   values() 转list

这种方法不需要导入方法,使用values方法获取一个可迭代的dict序列,在使用list函数转成list对象

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzspsz.html