def check_links(hrefs_list):
check_str = ['NEWS',
'MEDIA',
'news',
'media',
'News',
'Media',
'press',
'releases',
'Press',
'Releases',
'PRESS',
'RELEASES']
relevant_links=list()
for i in range(len(hrefs_list)):
if hrefs_list[i].find(check_str)!= -1:
relevant_links.append(hrefs_list[i])
else:
continue
return relevant_links
check_links(hrefs_list) accepts a list of href values. I want to go to each href value and check if it contains any of the keyword present in the check_str list. If it does, I want to store it to a fresh list, otherwise not. But when I run this function it gives an error : if hrefs_list[i].find(check_str)!= -1: TypeError: must be str, not list
How do I solve this ?