{"id":21610,"date":"2020-12-22T14:33:24","date_gmt":"2020-12-22T22:33:24","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=21610"},"modified":"2023-12-01T04:06:23","modified_gmt":"2023-12-01T12:06:23","slug":"python-flatten-list","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/","title":{"rendered":"Python Flatten List: A How-To Guide"},"content":{"rendered":"\n<p><em>Flattening a list refers to the process of removing a dimension from a list. A dimension refers to an additional co-ordinate needed to locate an item in a list. You can flatten a Python list using a list comprehension, a nested for loop, or the itertools.chain() method. <\/em><\/p>\n\n\n\n<p>A <a href=\"https:\/\/careerkarma.com\/blog\/python-array\/\">Python list<\/a> can contain multiple dimensions. This means that you have a list within lists. These lists, sometimes referred to as \u2018nested lists,\u201d can be converted back into a regular list.<\/p>\n\n\n\n<p>This means you can move all the values from lists within a list to a single list. Turning a list of lists into a list is called \u201cflattening a list.\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Flatten List<\/h2>\n\n\n\n<p>There are three ways to flatten a Python list:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Using a list comprehension.<\/li><li>Using a nested for loop.<\/li><li>Using the itertools.chain() method.<\/li><\/ul>\n\n\n\n<p>In this guide, we talk about how to flatten a list using a list comprehension, a for loop, and the <em>itertools.chain()<\/em> method. We walk through two examples so you can start flattening lists in your own programs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Flatten List Using a List Comprehension<\/h2>\n\n\n\n<p>A <a href=\"https:\/\/careerkarma.com\/blog\/python-list-comprehension\/\">Python list comprehension<\/a> defines a list based on the contents of an existing list. You can customize each element that goes into your new list by specifying conditions or changes within the comprehension.<\/p>\n\n\n\n<p>Comprehensions are syntactic sugar for using a for loop to iterate over a list and generate a new list. This means they work in the same fundamental way as a for loop but use different syntax.<\/p>\n\n\n\n<p>Here is the syntax for a list comprehension:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>numbers = [1, 2, 3]\n\nnew_numbers = [number * 2 for number in numbers]<\/pre><\/div>\n\n\n\n<p>This comprehension multiplies each number in our &#8220;numbers&#8221; list by 2.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flatten List: List Comprehension Example<\/h3>\n\n\n\n<p>We have a list of lists that contains different sandwich fillings available at a restaurant. Currently, our list of lists looks like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>foods = [\n\t[&quot;Tomato and Cucumber&quot;, &quot;Hummus, Beetroot, and Lettuce&quot;],\n\t[&quot;Cheese&quot;, &quot;Egg&quot;],\n\t[&quot;Ham&quot;, &quot;Bacon&quot;, &quot;Chicken Club&quot;, &quot;Tuna&quot;]\n]<\/pre><\/div>\n\n\n\n<p>The first list contains vegan sandwich fillings; the second list contains vegetarian sandwich fillings; the third list contains all sandwich fillings that contain meat.<\/p>\n\n\n\n<p>We want to change this list into a single list of foods. It is easier to work with a list with one dimension rather than two. There is no need to have more than one dimension in this list. To remove the second dimension from our list, we can use a list comprehension:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>new_foods = [food for sublist in foods for food in sublist]\nprint(new_foods)<\/pre><\/div>\n\n\n\n<p>This list comprehension iterates over every list in the \u201cfoods\u201d <a href=\"https:\/\/careerkarma.com\/blog\/python-variables\/\">Python variable<\/a>. Each value is then added to a main list. Once our list is generated, we print it out to the console.\n\n<\/p>\n\n\n\n<p>Let&#8217;s our code and see what happens:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>['Tomato and Cucumber', 'Hummus, Beetroot, and Lettuce', 'Cheese', 'Egg', 'Ham', 'Bacon', 'Chicken Club', 'Tuna']<\/pre><\/div>\n\n\n\n<p>Our list of lists has been successfully transformed into a flat list. All ingredients now appear inside one list instead of three.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Flatten List Using a Nested For Loop<\/h2>\n\n\n\n<p>We also achieve this same result by using a nested <a href=\"https:\/\/careerkarma.com\/blog\/python-for-loop\/\">Python for loop<\/a>. \u201cNested for loop\u201d is another way of saying \u201ca for loop within a for loop.\u201d Our list comprehension is another way of representing the following for loop:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>new_foods = []\nfor sublist in foods:\n\tfor food in sublist:\n\t\tnew_foods.append(food)\n\nprint(new_foods)<\/pre><\/div>\n\n\n\n<p>Our code uses two for loops to iterate over each list item in each list in the original list of lists. Let\u2019s run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>['Tomato and Cucumber', 'Hummus, Beetroot, and Lettuce', 'Cheese', 'Egg', 'Ham', 'Bacon', 'Chicken Club', 'Tuna']<\/pre><\/div>\n\n\n\n<p>Our program returns the same result as our list comprehension. In most cases, a list comprehension is a better solution than a for loop. List comprehensions are shorter and, in this case, are easier to read than a nested for loop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Flatten List Using Itertools<\/h2>\n\n\n\n<p>Itertools is a module in the Python standard library. The module provides a range of methods, making it easy to work with iterable objects and generators.\n\n<\/p>\n\n\n\n<p>For our purposes, we only refer to the <em>chain()<\/em> method. This method accepts a list of lists and returns a flattened list.\n\n<\/p>\n\n\n\n<p>Start by importing the itertools module into our code using a <a href=\"https:\/\/careerkarma.com\/blog\/python-import\/\">Python import statement<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import itertools<\/pre><\/div>\n\n\n\n<p>Next, define the list of lists and use the <em>chain()<\/em> method to flatten the list:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>foods = [\n\t[&quot;Tomato and Cucumber&quot;, &quot;Hummus, Beetroot, and Lettuce&quot;],\n\t[&quot;Cheese&quot;, &quot;Egg&quot;],\n\t[&quot;Ham&quot;, &quot;Bacon&quot;, &quot;Chicken Club&quot;, &quot;Tuna&quot;]\n]\n\nnew_foods = itertools.chain(*foods)<\/pre><\/div>\n\n\n\n<p>In our code, we use the * symbol to unpack our list. This converts our list into function arguments that can be parsed by the <em>chain()<\/em> method.\n\n<\/p>\n\n\n\n<p>The <em>chain()<\/em> method returns an itertools.chain object. To see our flattened list, we have to convert this object to a list. We do this using the <em>list()<\/em> method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>print(list(new_foods))<\/pre><\/div>\n\n\n\n<p>Let\u2019s execute our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>['Tomato and Cucumber', 'Hummus, Beetroot, and Lettuce', 'Cheese', 'Egg', 'Ham', 'Bacon', 'Chicken Club', 'Tuna']<\/pre><\/div>\n\n\n\n<p>Our code has flattened our list.\n\n<\/p>\n\n\n\n<p>While itertools is an effective way at flattening a list, it is more advanced than the last two approaches we have discussed.<\/p>\n\n\n\n<p>This is because you must import itertools into your code which introduces a new dependency. What\u2019s more, the <em>chain()<\/em> method involves unpacking which can be difficult to understand.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>You can flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method. The list comprehension is the most &#8220;Pythonic&#8221; method and is therefore favoured in most cases.<\/p>\n\n\n\n<p>While nested for loops are effective, they consume more lines of code than a list comprehension. The itertools.chain() method is similarly effective but it can be difficult for beginners to understand.<\/p>\n\n\n\n<p>There&#8217;s usually no need to import a new library &#8212; itertools &#8212; when Python gives you all the tools you need to flatten a list.<\/p>\n\n\n\n<p>Do you want to learn more about Python? Check out our complete <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-python\/\">How to Learn Python guide<\/a>. You&#8217;ll find expert learning tips and a list of top courses and books from which you can learn.<\/p>\n","protected":false},"excerpt":{"rendered":"Flattening a list refers to the process of removing a dimension from a list. A dimension refers to an additional co-ordinate needed to locate an item in a list. You can flatten a Python list using a list comprehension, a nested for loop, or the itertools.chain() method. A Python list can contain multiple dimensions. This&hellip;","protected":false},"author":240,"featured_media":14366,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-21610","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Flatten List: A How-To Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Flatten List: A How-To Guide\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-22T22:33:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:06:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Flatten List: A How-To Guide\",\"datePublished\":\"2020-12-22T22:33:24+00:00\",\"dateModified\":\"2023-12-01T12:06:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\"},\"wordCount\":887,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\",\"name\":\"Python Flatten List: A How-To Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg\",\"datePublished\":\"2020-12-22T22:33:24+00:00\",\"dateModified\":\"2023-12-01T12:06:23+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg\",\"width\":1020,\"height\":680,\"caption\":\"MacBook Pro displaying computer language codes\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Flatten List: A How-To Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Flatten List: A How-To Guide | Career Karma","description":"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.","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:\/\/careerkarma.com\/blog\/python-flatten-list\/","og_locale":"en_US","og_type":"article","og_title":"Python Flatten List: A How-To Guide","og_description":"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.","og_url":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-12-22T22:33:24+00:00","article_modified_time":"2023-12-01T12:06:23+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Flatten List: A How-To Guide","datePublished":"2020-12-22T22:33:24+00:00","dateModified":"2023-12-01T12:06:23+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/"},"wordCount":887,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-flatten-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/","url":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/","name":"Python Flatten List: A How-To Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg","datePublished":"2020-12-22T22:33:24+00:00","dateModified":"2023-12-01T12:06:23+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn how to flatten a Python list using a list comprehension, a nested for loop, and the itertools.chain() method.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-flatten-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/04\/caspar-camille-rubin-fPkvU7RDmCo-unsplash.jpg","width":1020,"height":680,"caption":"MacBook Pro displaying computer language codes"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-flatten-list\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Flatten List: A How-To Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=21610"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21610\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/14366"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=21610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=21610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=21610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}