{"id":6919,"date":"2025-01-29T06:37:59","date_gmt":"2025-01-29T06:37:59","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=6919"},"modified":"2025-01-29T06:38:03","modified_gmt":"2025-01-29T06:38:03","slug":"how-to-concatenate-two-lists-in-python","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/","title":{"rendered":"How to Concatenate Two Lists in Python"},"content":{"rendered":"\n<p>Almost every Python developer heavily relies on lists to store and manipulate data. Sometimes they may need to join two or more lists in Python. This is often required if you want to combine two or more data sets into one for further processing. There are several ways to combine lists in Python. In this article, we will learn how to concatenate two lists in Python.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#How_to_Concatenate_Two_Lists_in_Python\" >How to Concatenate Two Lists in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#1_Using_operator\" >1. Using + operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#2_Using_operator\" >2. Using += operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#3_Using_chain_function\" >3. Using chain() function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#4_Using_Unpacking_Operator\" >4. Using Unpacking Operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#5_Using_Extend_function\" >5. Using Extend() function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Concatenate_Two_Lists_in_Python\"><\/span>How to Concatenate Two Lists in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are the different ways to concatenate two lists in Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_operator\"><\/span>1. Using + operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python provides &#8216;+&#8217; operator to concatenate two or more lists. Please note, it creates a new list as a result and does not modify any of the existing lists. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">list1 + list2 + ...<\/pre>\n\n\n\n<p>Here is an example to combine two lists using this operator.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = a + b<br>print(c) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<p>You can also use it to join more than 2 lists.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = [7, 8, 9]<br>d = a + b + c<br>print(d) # output is [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/pre>\n\n\n\n<p>Please note, the &#8216;+&#8217; operator copies only the shallow copies of each list. If your list contains simple data types such as numbers and strings, this will work as it is. If you need to use deep copies of the lists, then you can call copy.deepcopy() function on the list before concatenation.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import copy<br>a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = copy.deepcopy(a) + copy.deepcopy(b)<br>print(c) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<p>This operator is available in every Python version and has not restrictions. You can easily use it to concatenate two or more lists.<\/p>\n\n\n\n<p>Also, please note, if there are any duplicate elements in the list, they will be included as it is in the result, without deduplication.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [1, 2, 3]<br>c = a + b<br>print(c) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_operator\"><\/span>2. Using += operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the above example, the &#8216;+&#8217; operator creates a new list to store the result. If you want to concatenate one of the two lists to the other list, then you can use += operator instead. It will modify the resultant list without creating a new one. This is useful if your lists are very big and you do not want to store the result in a new list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br>b += a<br>print(b) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<p>As you can see above, list b is modified while list a remains unchanged. No new list is created.<\/p>\n\n\n\n<p>This operator is also available in every Python version. But it works on only two lists at a time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_chain_function\"><\/span>3. Using chain() function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>So far, we have seen examples where the result of list concatenation is stored in a new or one of the two lists. If you are working with large lists, this can occupy a lot of space and the operation itself can be very slow. In such cases, you may want to use itertools. It is a powerful Python library that offers many useful functions to work with iterables such as lists. It provides a function called chain() that is used to concatenate iterables such as lists. It returns an iterator to a generator object instead of returning a list of final output. You can loop through this iterable to get items of concatenated list. Here is an example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import itertools<br>a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = itertools.chain(a,b) # output is [1, 2, 3, 4, 5, 6]<br><br>for i in c:<br>    print(i)<\/pre>\n\n\n\n<p>Here is its output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1<br>2<br>3<br>4<br>5<br>6<\/pre>\n\n\n\n<p>In the above code, we first import itertools. Then we call chain() function on the two lists. This returns an iterator object to the concatenated list. We loop through this list to get each item of the concatenated list.<\/p>\n\n\n\n<p>If you print the result c directly, you will see that it is an iterator and not a list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import itertools<br>a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = itertools.chain(a,b)<br>print(c) # output is &lt;itertools.chain object at 0x7a03c8c2d4b0><\/pre>\n\n\n\n<p>Please note, itertools is available in Python >= 2.3.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_Unpacking_Operator\"><\/span>4. Using Unpacking Operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you use Python >= 3.5, you can use unpacking operator for this purpose. It is very convenient and can be used to combine two or more iterables such as lists, tuples, etc. It is applied by prefixing the iterable with a * operator. Here is its syntax to concatenate lists\/<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[*list1, *list2, ...]<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = [*a, *b]<br>print(c) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<p>You can also use it to join more than 2 lists at a time.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br>c = [7, 8, 9]<br>d = [*a, *b, *c]<br>print(d) # output is [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/pre>\n\n\n\n<p>Please note, this method also creates a new list to store the result without changing the original lists.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Using_Extend_function\"><\/span>5. Using Extend() function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Every list also supports built-in function extend() that allows you to easily combine one list into another. It is also available in all Python versions. It modifies the target list while leaving the other list unchanged.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = [1, 2, 3]<br>b = [4, 5, 6]<br><br>a.extend(b)<br>print(a) # output is [1, 2, 3, 4, 5, 6]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt many different ways to concatenate lists in Python. You can use any of these methods as per your requirement. + and += operators work on all Python versions. The former operator creates a new list whereas the latter modifies one of the existing lists. Itertools.chain() function is available in Python 2.3 and returns an iterator to the concatenated list.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-list-all-files-in-directory\/\">How to List All Files in Directory<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-clone-list-in-python\/\">How to Clone List in Python<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-delete-file-or-folder-in-python\/\">How to Delete File or Folder in Python<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.<\/p>\n","protected":false},"author":1,"featured_media":6942,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301],"tags":[382],"class_list":["post-6919","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-concatenate-lists"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Concatenate Two Lists in Python - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Concatenate Two Lists in Python - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-29T06:37:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-29T06:38:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"308\" \/>\n\t<meta property=\"og:image:height\" content=\"204\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Concatenate Two Lists in Python\",\"datePublished\":\"2025-01-29T06:37:59+00:00\",\"dateModified\":\"2025-01-29T06:38:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/\"},\"wordCount\":757,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1\",\"keywords\":[\"concatenate lists\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/\",\"name\":\"How to Concatenate Two Lists in Python - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1\",\"datePublished\":\"2025-01-29T06:37:59+00:00\",\"dateModified\":\"2025-01-29T06:38:03+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1\",\"width\":308,\"height\":204,\"caption\":\"concatenate list in python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-concatenate-two-lists-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Concatenate Two Lists in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Concatenate Two Lists in Python - Ubiq BI","description":"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/","og_locale":"en_US","og_type":"article","og_title":"How to Concatenate Two Lists in Python - Ubiq BI","og_description":"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2025-01-29T06:37:59+00:00","article_modified_time":"2025-01-29T06:38:03+00:00","og_image":[{"width":308,"height":204,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Concatenate Two Lists in Python","datePublished":"2025-01-29T06:37:59+00:00","dateModified":"2025-01-29T06:38:03+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/"},"wordCount":757,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1","keywords":["concatenate lists"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/","name":"How to Concatenate Two Lists in Python - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1","datePublished":"2025-01-29T06:37:59+00:00","dateModified":"2025-01-29T06:38:03+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes you may need to join two or more lists in Python. Here are different ways to concatenate two lists in Python.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1","width":308,"height":204,"caption":"concatenate list in python"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-concatenate-two-lists-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Concatenate Two Lists in Python"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/concatenate-list-in-python.jpg?fit=308%2C204&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1NB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=6919"}],"version-history":[{"count":20,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6919\/revisions"}],"predecessor-version":[{"id":6941,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6919\/revisions\/6941"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/6942"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=6919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=6919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=6919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}