[Python Glasgow] consecuetive members of a list

Hedieh Ebrahimi hedieh.ebrahimi at amphos21.com
Wed Apr 30 11:53:20 CEST 2014


Hi all,

Imagine I have a list like this:

myList= [1, 7, 19, 1110]

from this list I like to create a list of tuple of ranges like this.

[(1,7),(7,19),(19,1110)]

How can I do this in an efficient way ?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/glasgow/attachments/20140430/03b7aeae/attachment.html>


More information about the Glasgow mailing list