Из списка вытащить e-mail
Имеется список со словами, необходимо вернуть электронный адрес.
Условия прописал, но выпадает ошибка TypeError:
list indices must be integers or slices, not str
код:
text = "мое мыло hot@mail.ru"
text = text.split()
for word in text:
if text[word].count("@") == 1 and text[word][0] != "@" and text[word].count(".") > 0 and text[word].rfind(".") > text[word].find("@"):
print(word)
Источник: Stack Overflow на русском