I have a python list as follows:
>>>list1 = ['Mary','had','a','little','lamb','which','was','very','naughty']
Now i want to create a create a sublist with elements from little to very. So i did the following :
>>> list1[list1.index('little'):list1.index('very')+1]
['little', 'lamb', 'which', 'was', 'very']
What I want to do is rather than specifying the entire element, check for a substring in the element using the in function and then slice the list like :
>>> list1[list1.index('lit'):list1.index('ver')+1]
how would i do that ?