Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将django中的键val更改为list_Python_Django - Fatal编程技术网

Python 将django中的键val更改为list

Python 将django中的键val更改为list,python,django,Python,Django,如何将此格式更改为简单列表 [{'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 350}, {'qte': 11}] 这是这个要求的结果

如何将此格式更改为简单列表

 [{'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 100}, {'qte': 350}, {'qte': 11}] 
这是这个要求的结果

inst = Produit.objects.values('qte')
print inst
我需要像这样的格式

[100,100,100,100,100,100.....]
您可以使用
flat=True
参数代替

inst = Produit.objects.values_list('qte', flat=True)
您可以使用
flat=True
参数代替

inst = Produit.objects.values_list('qte', flat=True)