Answers for "how to combine two elements in list python"

0

merge lists in list python

import itertools
a = [['a','b'], ['c']]
print(list(itertools.chain.from_iterable(a)))
Posted by: Guest on June-03-2020
0

how to join two lists in python

#define lists
my_list = ["a", "b"]
other_list = [1, 2]

#extend my_list by adding all the values from other_list into my list
my_list.extend(other_list)

# output: ['a', 'b', 1, 2]
Posted by: Guest on May-20-2021

Code answers related to "how to combine two elements in list python"

Python Answers by Framework

Browse Popular Code Answers by Language