Python – How to join two list

In Python, you can simply join two list with a plus + symbol like this:


list1 = [1,2,3]
list2 = [4,5,6]

list3 = list1 + list2

print list3 #[1, 2, 3, 4, 5, 6]
Note
Try to compare with this Java example – how to join arrays. Python really makes join list extremely easy.

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments