Hope you guys help me to Get same object in multi Querysets in Python. I use Django Framework
I assumed that I have 2 Queryset:
qrs1 = [1, 2, 3, 5, 9] and
qrs2 = [1, 4, 2, 5] I want to print result with this queryset:
[1, 2, 5] Hope you guys help me to Get same object in multi Querysets in Python. I use Django Framework
I assumed that I have 2 Queryset:
qrs1 = [1, 2, 3, 5, 9] and
qrs2 = [1, 4, 2, 5] I want to print result with this queryset:
[1, 2, 5] You can cast your first queryset to set and call intersection method of this set.
set(qrs1).intersection(qrs2)