简体   繁体   中英

How can we append list of list , with another list of item ,inside list of every list

having two list like following

l1=[56,92]
l2=[ [['abc','cda'],['abc','dba']] , [['xyz','sdf'],['sdf','dfg'],['pdf','hfg']] ]

i want output like this: (adding end of every list of that sublist)

l2=[ [['abc','cda',56],['abc','dba',56]] , [['xyz','sdf',92],['sdf','dfg',92],['pdf','hfg',92]] ]

Something like this?

 for i, sub_l2 in enumerate(l2):
        for l in sub_l2:
            l.append(l1[i])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM