How to Find Common Values in Two Python Sets

How to Find Common Values in Two Python Sets

Python Tip: Use Python Set intersection to find common values between two sets.

Here's an example 👇

vlans = {100, 200, 300}

# Intersection of two sets using &
vlans & {100, 500, 300}
# Output: {100, 300}

Subscribe to our newsletter to keep updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox.
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!