lets say i have text file
1234
5678
9012
3456
7890
1245
3678
4367
3454
4536
8768
1678
i want to extract all these into list and then convert that list into a list of lists of length say 2 so it should become
[[1234,5678],[9012,3456],[7890,1245]..........]
so far i am doing this:
with open(infile) as f:
all_stores =[]
batch=[next(f).rstrip() for x in range(2)]
all_stores.append(batch)
I also tried list comprehensions . but i am doing it wrong
# mylist=[[all[stores] for i in range(10)]for el in all_stores]
Would appreciate some help.I am using Python and a windows 10. sorry for being a noob.