poi = booking_models.TestBooking.objects.filter(customer_visit=instance).values_list("package__package_name", "amount").order_by("package").distinct()
[(None, 392.0), (None, 530.0), ('RahulNewPaackage', 3999.0), ('Suraj pkg today all', 699.0), ('suraj 44', 599.0)]
I am learning python and django and trying to get only numbers from this output(poi). I want to get this in a list like this [392.0, 530.0, 3999.0, 699.0, 599.0]. As poi will iterate many times so every time till the last item there will be output of list of numbers. How to achieve this ? Any help will be really appreciated. Thank you !!
>Solution :
You each time want the second item, so you can work with list comprehension:
[x for _, x in poi]