Ask Your Question

merge lists of lists

asked 2016-04-02 01:42:11 +0200

j0equ1nn gravatar image

updated 2016-04-02 02:03:19 +0200

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 16:50:45 +0200

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-02 01:42:11 +0200

Seen: 1,132 times

Last updated: Apr 02 '16