I have a list that I acquired parsing a text file(delimeted by \t and \n) which I eventually have to import into a database:
list = ['1', '1', 'Thurs', '1', 'Snow', '1', 'Rockville', 'Basic', 'Medium',
'1', 'Smith, J.', 'Junior', '5', '1', 'Chicken Noodle', 'Progresso',
'Canned', 'Basic', '1', 'Radio', 'Morning Drive', 'Weekday', '405.18''2',
'1', 'Thurs', '1', 'Snow', '1', 'Rockville', 'Basic', 'Medium', '1', 'Smith,
J.', 'Junior', '5', '2', 'Chicken Noodle', 'Campbells', 'Canned', 'Basic',
'1', 'Radio', 'Morning Drive', 'Weekday', '453.30' ..... list continues]
After each 23 items a new record starts. I though that what I need is to slice 4-5 items with a step of 23. So I am trying the following:
sliceN = slice(14-18)
listSlice=list[sliceN:-1:23]
This doesn't work. I would really appreciate any advise on solving my issue. If there are other better ways to approach it please let me know.