0

Suppose I am having two list of lists as :

a=[['10', '1', '10-08-2017'], ['10', '1', '27-07-2017']]

b=[['SKS', ' SKSIND '], ['Arcotech', ' ARCOTECH ']]

Expected output:

[['SKS', ' SKSIND ','10', '1', '10-08-2017'], ['Arcotech', ' ARCOTECH ','10', '1', '27-07-2017']]

What I am trying is:

s=[ a[i].extend(b[i]) for i in range(len(a))]
print (s)
#[None, None]---Output

Can someone please help.

4
  • list.exted() changes the lists in-place, it doesn't return a new list. You can use zip and add operation instead. Commented Aug 3, 2017 at 7:45
  • 2
    Here is an exact duplicate stackoverflow.com/questions/7806511/python-merge-nested-lists Commented Aug 3, 2017 at 7:49
  • Thanks it works now.. Commented Aug 3, 2017 at 7:53
  • for i in range(len(a)): a[i].extend(b[i]) print (a)------[['SKS', ' SKSIND ', '10', '1', '10-08-2017'], ['Arcotech', ' ARCOTECH ', '10', '1', '27-07-2017']] Commented Aug 3, 2017 at 7:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.