Reputation: 5565
I am looking to append item to every list in a list of list.
I had expected the following code to work:
start_list = [["a", "b"], ["c", "d"]]
end_list = [item.append("test") for item in start_list]
with expected output [["a", "b", "test"], ["c", "d", "test"]]
instead i get [None, None]
First, why does this occur, and second, how do i achieve the desired output?
Upvotes: 1
Views: 975