0

I have one list but I'd like to divide this list into a list of lists. The final list should be made of lists with 4 items in each lists. The order of the original list should remain the same.

For example:

lst = ['201,904', '17,998', '14,421', '14', '66,000', '5,502', '9,428', '7', 0, 0, 0, '0', '32,300', '2,816', '10,766', '3']


Goal_lst = [['201,904', '17,998', '14,421', '14'], ['66,000', '5,502', '9,428', '7'], [0, 0, 0, '0'], ['32,300', '2,816', '10,766', '3']]

I'd like to also be able to carry out this function if I wanted the Goal_lst to have each sublist only 2 items.

Chris
  • 5,444
  • 16
  • 63
  • 119
  • I think you are right - I didn't see that, but thank you! Anyway to delete? – Chris May 26 '14 at 14:57
  • 1
    There's no need to delete. This question can be useful to other people because it makes it easier for anyone who describes the problem in the same way to find the linked answer. – DSM May 26 '14 at 14:59

0 Answers0