I have two lists. I need to compare elements whether any element in the list is matching or not. Input:
a = ['1001,1715']
b = ['1009,1715']
Output : 1715
Please suggest how to do it? I tried doing:
set(''.join(a))
and
set(''.join(b))
but it gave me {'5', '0', '7', ',', '1'}. how can I convert ['1001,1715'] to [1001,1715] ?
a = ['1001,1715']
b = ['1009,1715']
def fun(a):
return a[0].split(",")
def intersect(a, b):
return list(set(a) & set(b))
print(intersect(fun(a),fun(b)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With