Ask Your Question

merge lists of lists

asked 2016-04-01 18:42:11 -0500

j0equ1nn gravatar image

updated 2016-04-01 19:03:19 -0500

I realize that if I have two lists, say

l1 = [1,2,3]
l2 = [4,5,6]

then I can join them via

l1 + l2

i.e. this gives [1,2,3,4,5,6].

I want to know how to do this when my list is not a list of numbers, but a list of matrices. I imagine it would be the same for a list of lists but I don't know how to do that either.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-02 09:50:45 -0500

nbruin gravatar image

just use + as well. Python doesn't care what's in lists when it concatenates them.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-01 18:42:11 -0500

Seen: 816 times

Last updated: Apr 01 '16