得到IDS,我有以下的Django過濾器的查詢:如何使用values_list蟒蛇
ids = Worksheet.objects.filter(main=main_rec_id).values_list('id', flat=True)
但它返回像[5L, 6L]
長值我怎樣才能像[5,6]球員名單?提前致謝。
得到IDS,我有以下的Django過濾器的查詢:如何使用values_list蟒蛇
ids = Worksheet.objects.filter(main=main_rec_id).values_list('id', flat=True)
但它返回像[5L, 6L]
長值我怎樣才能像[5,6]球員名單?提前致謝。
使用本
ids = Worksheet.objects.filter(main=main_rec_id).values_list('id', flat=True)
ids = map(lambda x:int(x),ids)
IDS將是純整數LIST
map(lambda x:int(x),ids) –
@Sayse:我的編輯答案有幫助嗎? –
它產生操作員正在尋找的輸出,但它可能仍然不是必需的。建議的重複項目已經提供瞭解釋。 – Sayse
一些沒有影響在這裏解釋:[django整數字段返回長](http://stackoverflow.com/questions/7733002/django-integerfield-returning-long) –