fir3net

PPS-Firenetbanner-780.5x190-30-03-17

Python - Check for Items across Sets

Within this example we will check if the same item exists across 2 sets. If so then a boolean is returned,

>>> s1 = set([1, 2, 3])
>>> s2 = set([3, 4, 5])
>>> bool(set(s1) & set(s2))
True

Tags: Python