18
Aug
Learn how to use append to merge two lists in python
You can use following code to merge two lists in python.
listone = [1,2,3] listtwo = [4,5,6] newlist =[] for elem in listone: newlist.append(elem) for elem in listtwo: newlist.append(elem)
Another way to do it.
listone = [1,2,3] listtwo = [4,5,6] newlist = listone + listtwo
And another way to do it.
newlist = [] newlist.extend(listone) newlist.extend(listtwo)