I have a variable with n words, separated by whitespaces. str.split()
returns a list
of these words, which is then converted to a tuple
with tuple()
, which is finally converted to a frozenset
and added to the set
of frozensets
. For some reason this returns:
TypeError: 'builtin_function_or_method' object is not subscriptable
my code:
set = set([])
str = 'a b c d'
set.add[frozenset(tuple(set.split()))]
problems already addressed :
- tried to make a
set
of sets` - tried to make a
frozenset
out oflists
- accidentally used
.append
instead of.add
(Btw this is my first question on stack overflow)
New contributor
F-22 Destroyer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.