Odoo Technical

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

How do I merge multiple sub-arrays (lists) into one set of unique elements in Python?

Avatar
pavithra_s

How do I merge multiple sub-arrays (lists) into one set of unique elements in Python?

Avatar
Discard
1 Answer
0
Avatar
harini_s
Best Answer

language: Py

Converting a sub-array within the array to set can be used as below.

a = [['1','2','3'],['1','2','5'],['1','4','3']]

print( set().union(*a) )

result: {'5', '3', '4', '1', '2'}


Avatar
Discard