0

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] 
1

2 Answers 2

1

You can cast your first queryset to set and call intersection method of this set.

set(qrs1).intersection(qrs2) 
Sign up to request clarification or add additional context in comments.

Comments

1
 qrs1 = [1, 2, 3, 5, 9] qrs2 = [1, 4, 2, 5] list(set(qrs1).intersection(qrs2)) 

you just need an intersection of the querysets

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.