I am very new to python and coding so need some ideas on how to tackle this.
I have a list on elements which look like this -
lst = ['res/entertainment/578.txt',
'res/tv/232.txt',
'res/news/323.txt',
'res/kids/323.txt',
'res/entertainment/323.txt',
'res/kids/325.txt',
'res/kids/542.txt',
'res/kids/008.txt']
categories = ['entertainment', 'tv', 'news', 'kids']
I want to create a sublist of mylist which only contains the relevant category related to the element in the list.
new_list = ['entertainment',
'tv',
'news',
'kids',
'entertainment',
'kids',
'kids',
'kids]