I have a list of list that I want to append a constant value to each sublist of the full list, for instance:
_lst = [[1, 2], [3, 4], [5, 6]]
and I want to append 7 to each of the sublist so that _lst becomes:
[[1, 2, 7], [3, 4, 7], [5, 6, 7]]
Is there a good way to complete the job (such as using zip)? Thanks!
for l in _lst:
l.append(7)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With