Я пытаюсь реализовать функцию с помощью регулярных выражений для удаления тегов и возврата списка строк, найденных в текстовом файле. Однако возникает следующая ошибка:
AssertionError: Wrong type for output extracted_words. Got <class 'str'>, expected <class 'list'>
Это мой код ниже, помощь будет оценена.
import re
def get_words(text):
"""
Extracting words from the text
The 'text' parameter is the file which contains strings inside
Objective: To return a list of strings found in the text called 'extracted_words'
"""
# Implementation
extracted_words = re.sub('<[^>]*>', '', text)
return extracted_words