{"id":18267,"date":"2021-08-20T17:12:10","date_gmt":"2021-08-20T11:42:10","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=18267"},"modified":"2021-08-20T17:12:13","modified_gmt":"2021-08-20T11:42:13","slug":"python-remove-duplicates-from-list-of-lists-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","title":{"rendered":"Python remove duplicates from list of lists | Example code"},"content":{"rendered":"\n<p>Use the<strong> itertools<\/strong> to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to this kind of problem.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example remove duplicates from the lists of list in Python<\/strong><\/h2>\n\n\n\n<p>Simple example code. Before removing duplicates from a list you have to <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-sort-list-of-strings-how-to-sort-a-list-of-strings-example-code\/\">sort the list<\/a> and don&#8217;t forget to <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-import-module-library-package-file-system\/\">import <\/a>the itertools <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-modules-import-custom-builtin-package\/\">module<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import itertools\r\n\r\nk = &#91;&#91;1, 2], &#91;4], &#91;5, 6, 2], &#91;1, 2], &#91;3], &#91;4]]\r\nk.sort()\r\nres = list(k for k, _ in itertools.groupby(k))\r\nprint(res)\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"383\" height=\"118\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?resize=383%2C118&#038;ssl=1\" alt=\"Python remove duplicates from list of lists\" class=\"wp-image-18312\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Python remove duplicates from nested list<\/strong><\/h3>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Using sorted() + set()<\/strong> : Examples removing duplicate sublist.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;&#91;1, 2], &#91;4], &#91;5, 6, 2], &#91;1, 2], &#91;3], &#91;4]]\r\n\r\nres = res = list(set(tuple(sorted(sub)) for sub in list1))\r\nprint(res)\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: [(1, 2), (3,), (2, 5, 6), (4,)]<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Using set() + map() + sorted()<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;&#91;1, 2], &#91;4], &#91;5, 6, 2], &#91;1, 2], &#91;3], &#91;4]]\r\n\r\nres = res = list(set(map(lambda i: tuple(sorted(i)), list1)))\r\n  \r\nprint(res)\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: [(1, 2), (3,), (2, 5, 6), (4,)]<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts and suggestions on this list tutorial.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Use the itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to this kind of problem. Example remove duplicates from the lists of list in Python Simple example code. Before removing duplicates from a list you have to sort the list and don&#8217;t&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python remove duplicates from list of lists | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[83],"post_series":[],"class_list":["post-18267","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python remove duplicates from list of lists | Example code - EyeHunts<\/title>\n<meta name=\"description\" content=\"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python remove duplicates from list of lists | Example code - EyeHunts\" \/>\n<meta property=\"og:description\" content=\"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-20T11:42:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-20T11:42:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\",\"name\":\"Python remove duplicates from list of lists | Example code - EyeHunts\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg\",\"datePublished\":\"2021-08-20T11:42:10+00:00\",\"dateModified\":\"2021-08-20T11:42:13+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?fit=383%2C118&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?fit=383%2C118&ssl=1\",\"width\":383,\"height\":118},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python remove duplicates from list of lists | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python remove duplicates from list of lists | Example code - EyeHunts","description":"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...","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:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python remove duplicates from list of lists | Example code - EyeHunts","og_description":"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-08-20T11:42:10+00:00","article_modified_time":"2021-08-20T11:42:13+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","name":"Python remove duplicates from list of lists | Example code - EyeHunts","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg","datePublished":"2021-08-20T11:42:10+00:00","dateModified":"2021-08-20T11:42:13+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"Use itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to...","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?fit=383%2C118&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?fit=383%2C118&ssl=1","width":383,"height":118},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python remove duplicates from list of lists | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":18197,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-merge-two-lists-without-duplicates-example-code\/","url_meta":{"origin":18267,"position":0},"title":"Python merge two lists without duplicates | Example code","author":"Rohit","date":"August 19, 2021","format":false,"excerpt":"Python merges two lists without duplicates could be accomplished by using a set. And use the + operator to merge it. list(set(list1 + list2)) Python merge list without duplicates example Simple example code using set with + operator. a = ['hello', 'world'] b = ['hello', 'universe'] unique = list(set(a +\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python merge two lists without duplicates","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-merge-two-lists-without-duplicates.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":33019,"url":"https:\/\/tutorial.eyehunts.com\/python\/append-multiple-lists-python\/","url_meta":{"origin":18267,"position":1},"title":"Append multiple lists Python","author":"Rohit","date":"September 22, 2022","format":false,"excerpt":"Using the + operator or zip function or itertools chain you can append multiple lists in Python. The + operator does a straightforward job of joining the lists together. Append multiple lists of Python Simple example code appends elements of 2-3 lists to one list. l1 = [1, 3, 5,\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Append multiple lists Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/09\/Append-multiple-lists-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/09\/Append-multiple-lists-Python.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/09\/Append-multiple-lists-Python.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/09\/Append-multiple-lists-Python.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":34671,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-zip-different-length\/","url_meta":{"origin":18267,"position":2},"title":"Python zip different length","author":"Rohit","date":"December 6, 2022","format":false,"excerpt":"Python zip different lengths by equaling the length of the shortest input list. But the built-in zip won't repeat to pair with the list with a larger size list. Python zip different length Simple example code zip two differently sized lists, repeating the shorter list? The iterator will stop when\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python zip different length","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/12\/Python-zip-different-length.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":20610,"url":"https:\/\/tutorial.eyehunts.com\/python\/convert-tuple-to-list-python-example-code\/","url_meta":{"origin":18267,"position":3},"title":"Convert Tuple to list Python | Example code","author":"Rohit","date":"October 13, 2021","format":false,"excerpt":"Use the built-in list() function to convert a tuple to a list in Python. Simply passes the given tuple as an argument to the function. list(tuple) Example Tuple to list Python A simple example code initializes a tuple and converts it to a list using a list(sequence). # initialize tuple\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Convert Tuple to list Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/10\/Convert-Tuple-to-list-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":32990,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-merge-multiple-lists\/","url_meta":{"origin":18267,"position":4},"title":"Python merge multiple lists","author":"Rohit","date":"September 21, 2022","format":false,"excerpt":"Using + Operator\u00a0you can merge multiple lists in Python. In Python, concatenation can be performed on numbers, strings, and elements of a list. Python merges multiple lists A simple example code adds a list behind another list with retains the order of list elements and contains duplicate elements. list1 =\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python merges multiple lists","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/09\/Python-merges-multiple-lists.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":34694,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-zip-list-of-lists\/","url_meta":{"origin":18267,"position":5},"title":"Python zip list of lists","author":"Rohit","date":"December 6, 2022","format":false,"excerpt":"Use the * operator to zip a list of lists in Python. Another way is to use a combination of itertools.chain() + zip() methods. Python zip list of lists Simple example code. a = [[2, 4], [6, 8], [10, 12]]b = [['a', 'b', 'c'], ['1', '2', '3']]res = zip(*a, *b)print(list(res))\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python zip list of lists","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/12\/Python-zip-list-of-lists.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/12\/Python-zip-list-of-lists.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/12\/Python-zip-list-of-lists.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=18267"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18267\/revisions"}],"predecessor-version":[{"id":23992,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18267\/revisions\/23992"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=18267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=18267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=18267"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=18267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}