I have a list of lists, each list within the list contains 5 items, how do I change the values of the items in the list? I have tried the following:
for [ite
Variable unpacking does not seem to pass the reference but copies the values. An solution would be to do it like this:
foo = [[1, "gggg"], [3, "zzzz"]] for item in foo: item[0] = 2 item[1] = "ffff" print(foo) >>>> [[2, 'ffff'], [2, 'ffff']]