python `in` operator use cases
Python *in* operator is membership test operator.*Examples:*List—-
In [1]: python_webframeworks = ['flask', 'django', 'pylons', 'pyramid', 'brubeck'] In [2]: 'flask' in python_webframeworks Out[2]: True In [3]: 'web.py' in python_webframeworks Out[3]: False in operator iterates over the list of elements and returns True or False.
What about nested list?
In [4]: webframeworks = [['flask', 'django', 'pyramid'],['rails', 'sintara'],['zend', 'symfony']] In [5]: 'flask' in webframeworks Out[5]: False in isnt handy for nested list, unless it is overriden.
[Read More]