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
You need to define wordList to begin with. And you cannot randomly assign indexes in an empty list. You can easily 'extend' the list with new values.
worldList = [] with fitxer as f: for line in f: wordList.extend(line.split()) return wordList