You can use a simple logic and list comprehension. so it will be like this
lst = [1, 2, 3, 4, 5, 6, 7, 8] print [lst[i:i+2] for i in range(0,len(lst),2)] Here 2 is the pairing number, You can set is as your need. On Tue, Jul 18, 2017 at 1:40 AM, <aaron.m.weisb...@gmail.com> wrote: > Hi, > > I'm having difficulty thinking about how to do this as a Python beginner. > > But I have a list that is represented as: > > [1,2,3,4,5,6,7,8] > > and I would like the following results: > > [1,2] [3,4] [5,6] [7,8] > > Any ideas? > > Thanks > -- > https://mail.python.org/mailman/listinfo/python-list > -- Regards *Rahul K P* Python Developer Mumbai +919895980223 -- https://mail.python.org/mailman/listinfo/python-list