Answers for "merge 2 list in python"

5

add two list in python

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

list1.extend(list2)
print(list1)
Posted by: Guest on May-17-2020
6

how to combine two lists in python

listone = [1,2,3]
listtwo = [4,5,6]

joinedlist = listone + listtwo
Posted by: Guest on November-19-2019
6

join lists python

first_list = ["1", "2"]
second_list = ["3", "4"]

# Multiple ways to do this:
first_list += second_list
first_list = first_list + second_list
first_list.extend(second_list)
Posted by: Guest on April-17-2020
1

merge list elements python

StringName = "seperator".join(ListName)

# Seperator denotes character between each of the joined list elements
Posted by: Guest on September-25-2020
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 combine 2 lists in python

l1 = [1,2,3,4]
l2 = [1,1,1,1]
l3 = [l1[x//2] if x % 2 == 0 else l2[x//2] for x in range(8)]
// l3: [1, 2, 3, 4, 5, 6, 7, 8]
Posted by: Guest on May-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language