I need to read some words text by text in python, and I am getting this error. \"NameError: global name \'wordList\' is not defined.
i=0
with fitxer as f:
fo
wordList
is not instantiated as a list or not in scope.
If Not needed because the object is mutatedwordList
is a global variable, the beginning of your function will need global wordList
If the list should only be in scope of the function you will need to instantiate it as a list.
wordList = []
Edit: as deceze pointed out
Within the function itself you should be appending to the list since the index does not exists.
wordList.append(word)