Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

Python NoneType object of __builtin__module

Solved! Go to Solution.

Hi there,


I'm trying to do something extremely simple. I have a list and want to append a variable to it (in the middle of a for loop).


i = "c"
matchlist = ["a","b"]
i = str(i)
matchlist = matchlist.append(i)


I expected to get a list 'matchlist' with two records ('a' and 'b') in it and then append a new record 'c' to that list. However instead the list loses its type and the value comes up as 'NoneType object of __builtin__ module' (I'm using Spyder).


Any pointers on where I'm going wrong?


Many thanks.

2 Replies
Copilot Lvl 2
Message 2 of 3

Re: Python NoneType object of __builtin__module

you dont have to do matchlist = matchlist.append(i)

matchlist is an array, so just append the element

reassigning matchlist = matchlist.append(i) will make matchlist as None because append method returns None

Copilot Lvl 2
Message 3 of 3

Re: Python NoneType object of __builtin__module

Great thanks - very helpful!