TypeError: 'list' object is not callable while trying to access a list
For accessing the elements of a list you need to use the square brackets ([]
) and not the parenthesis (()
).
Instead of:
print wordlists(len(words))
you need to use:
print worldlists[len(words)]
And instead of:
(wordlists(len(words))).append(words)
you need to use:
worldlists[len(words)].append(words)
To get elements of a list you have to use list[i]
instead of list(i)
.