I have a sorted python list which looks like:
myList = [1,2,3,7,8,9,12,13,14,15]
The consecutive elements with difference 1 form the cluster. I need to dig these clusters out.
In the above example the clusters would be 1,2,3
; 7,8,9
; 12,13,14,15
Is there a way other than to write a for loop and see where the difference between consecutive elements is > 1
Edit: The list I have is large so I want to avoid using a for loop as much as I can unless that is the only way out