Python 2.6 and above:
def func(a, b):
return not set(a).isdisjoint(b)
For 2.4 or 2.5:
def func(a, b):
return len(set(a).intersection(b)) != 0
For 2.3 and below:
sudo apt-get update
sudo apt-get upgrade
😉
More Related Contents:
- More ‘Pythonic’ way to write asymmetric if-else statement
- How on earth does this code work
- How to find elements by class
- Programmatically saving image to Django ImageField
- check what files are open in Python
- Beautiful Soup findAll doesn’t find them all
- Too many different Python versions on my system and causing problems
- Is it possible to modify variable in python that is in outer, but not global, scope?
- Pandas GroupBy and select rows with the minimum value in a specific column
- networkx – change color/width according to edge attributes – inconsistent result
- Child processes created with python multiprocessing module won’t print
- numpy get index where value is true
- How to use custom png image marker with plot?
- How to get current time in python and break up into year, month, day, hour, minute?
- Python vectorizing nested for loops
- Pandas – Number of Months Between Two Dates
- Attribute Error: ‘list’ object has no attribute ‘split’
- Fast prime factorization module
- Right-to-left string replace in Python?
- What can I do about “ImportError: Cannot import name X” or “AttributeError: … (most likely due to a circular import)”?
- How can I move the ball instead of leaving a trail all over the screen in pygame?
- Maximum and minimum value of C types integers from Python
- Pandas Passing Variable Names into Column Name
- how to center image inside a rect pygame
- Printing a string prints ‘u’ before the string in Python?
- Is i = i + n truly the same as i += n? [duplicate]
- Number of digits in exponent
- How do you determine which backend is being used by matplotlib?
- Sorting the order of bars in pandas/matplotlib bar plots
- How to send non-English unicode string using HTTP header?