Say I have a list that looks like this:
['item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9', 'item10']
Using Python, how would I grab pairs from it, where each item is included in a pair with both the item before and after it?
['item1', 'item2']
['item2', 'item3']
['item3', 'item4']
['item4', 'item5']
['item5', 'item6']
['item6', 'item7']
['item7', 'item8']
['item8', 'item9']
['item9', 'item10']
Seems like something i could hack together, but I'm wondering if someone has an elegant solution they've used before?