{"id":20920,"date":"2020-08-07T01:13:42","date_gmt":"2020-08-07T08:13:42","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=20920"},"modified":"2023-12-01T03:57:22","modified_gmt":"2023-12-01T11:57:22","slug":"python-valueerror-too-many-values-to-unpack-expected-2","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/","title":{"rendered":"Python valueerror: too many values to unpack (expected 2) Solution"},"content":{"rendered":"\n<p>Python does not unpack bags well. When you see the error \u201cvalueerror: too many values to unpack (expected 2)\u201d, it does not mean that Python is unpacking a suitcase. It means you are trying to access too many values from an iterator.<br><\/p>\n\n\n\n<p>In this guide, we talk about what this error means and why it is raised. We walk through an example code snippet with this error so you can learn how to solve it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Problem: valueerror: too many values to unpack (expected 2)<\/h2>\n\n\n\n<p>A ValueError is raised when you try to access information from a value that does not exist. Values can be any object such as <a href=\"https:\/\/careerkarma.com\/blog\/python-array\/\">a list<\/a>, a string, or a dictionary.<br><\/p>\n\n\n\n<p>Let\u2019s take a look at our error message:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>valueerror: too many values to unpack (expected 2)<\/pre><\/div>\n\n\n\n<p>In Python, \u201cunpacking\u201d refers to retrieving items from a value. For instance, retrieving items from a list is referred to as \u201cunpacking\u201d that list. You view its contents and access each item individually.<br><\/p>\n\n\n\n<p>The error message above tells us that we are trying to unpack too many values from a value.&nbsp;<br><\/p>\n\n\n\n<p>There are two mistakes that often cause this error:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>When you try to iterate over a <a href=\"https:\/\/careerkarma.com\/blog\/python-add-to-dictionary\/\">dictionary<\/a> and unpack its keys and values separately.<\/li><li>When you forget to unpack every item from a list to a <a href=\"https:\/\/careerkarma.com\/blog\/python-variables\/\">variable<\/a>.<\/li><\/ul>\n\n\n\n<p>We look at each of these scenarios individually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Iterating Over a Dictionary<\/h2>\n\n\n\n<p>Let\u2019s try to iterate over a dictionary. The dictionary over which we will iterate will store information about an element on the periodic table. First, let&#8217;s define our dictionary:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>hydrogen = {\n\t&quot;name&quot;: &quot;Hydrogen&quot;,\n\t&quot;atomic_weight&quot;: 1.008,\n\t&quot;atomic_number&quot;: 1\n}<\/pre><\/div>\n\n\n\n<p>Our dictionary has three keys and three values. The keys are on the left of the colons; the values are on the right of the colons. We want to print out both the keys and the values to the console. To do this, we use a for loop:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for key, value in hydrogen:\n\tprint(&quot;Key:&quot;, key)\n\tprint(&quot;Value:&quot;, str(value))<\/pre><\/div>\n\n\n\n<p>In this loop, we unpack \u201chydrogen\u201d into two values: key and value. We want \u201ckey\u201d to correspond to the keys in our dictionary and \u201cvalue\u201d to correspond to the values.<br><\/p>\n\n\n\n<p>Let\u2019s run our code and see what happens:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Traceback (most recent call last):\n  File &quot;main.py&quot;, line 8, in &lt;module&gt;\n\tfor key, value in hydrogen:\nValueError: too many values to unpack (expected 2)<\/pre><\/div>\n\n\n\n<p>Our code returns an error.<br><\/p>\n\n\n\n<p>This is because each item in the \u201chydrogen\u201d dictionary is a value. Keys and values are not two separate values in the dictionary.<br><\/p>\n\n\n\n<p>We solve this error by using a method called <a href=\"https:\/\/careerkarma.com\/blog\/iterate-through-dictionary-python\/\">items()<\/a>. This method analyzes a dictionary and returns keys and values stored as tuples. Let\u2019s add this method to our code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for key, value in hydrogen.items():\n\tprint(&quot;Key:&quot;, key)\n\tprint(&quot;Value:&quot;, str(value))<\/pre><\/div>\n\n\n\n<p>Now, let\u2019s try to run our code again:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Key: name\nValue: Hydrogen\nKey: atomic_weight\nValue: 1.008\nKey: atomic_number\nValue: 1<\/pre><\/div>\n\n\n\n<p>We have added the <code>items()<\/code> method to the end of \u201chydrogen\u201d. This returns our dictionary with key-value pairs stored as tuples. We can see this by printing out the contents of <code>hydrogen.items()<\/code> to the console:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>print(hydrogen.items())<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>dict_items([('name', 'Hydrogen'), ('atomic_weight', 1.008), ('atomic_number', 1)])<\/pre><\/div>\n\n\n\n<p>Each key and value are stored in their own tuple.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A Note for Python 2.x<\/h3>\n\n\n\n<p>In <a href=\"https:\/\/careerkarma.com\/blog\/python-2-vs-python-3\/\">Python 2.x<\/a>, you use <code>iteritems()<\/code> in place of <code>items()<\/code>. This achieves the same result as we accomplished in the earlier example. The <code>items()<\/code> method is still accessible in Python 2.x.&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for key, value in hydrogen.iteritems():\n\tprint(&quot;Key:&quot;, key)\n\tprint(&quot;Value:&quot;, str(value))<\/pre><\/div>\n\n\n\n<p>Above, we use <code>iteritems()<\/code> instead of <code>items()<\/code>. Let\u2019s run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Key: name\nValue: Hydrogen\nKey: atomic_weight\nValue: 1.008\nKey: atomic_number\nValue: 1<\/pre><\/div>\n\n\n\n<p>Our keys and values are unpacked from the \u201chydrogen\u201d dictionary. This allows us to print each key and value to the console individually.<br><\/p>\n\n\n\n<p>Python 2.x is starting to become deprecated. It is best to use more modern methods when available. This means <code>items()<\/code> is generally preferred over <code>iteritems()<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Unpacking Values to a Variable<\/h2>\n\n\n\n<p>When you unpack a list to a variable, the number of variables to which you unpack the list items must be equal to the number of items in the list. Otherwise, an error is returned.<br><\/p>\n\n\n\n<p>We have a list of <a href=\"https:\/\/careerkarma.com\/blog\/python-float\/\">floating-point numbers<\/a> that stores the prices of donuts at a local donut store:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>donuts = [2.00, 2.50, 2.30, 2.10, 2.20]<\/pre><\/div>\n\n\n\n<p>We unpack these values into their own variables. Each of these values corresponds to the following donuts sold by the store:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Raspberry jam<\/li><li>Double chocolate<\/li><li>Cream cheese<\/li><li>Blueberry<\/li><\/ul>\n\n\n\n<p>We unpack our list into four variables. This allows us to store each price in its own variable. Let\u2019s unpack our list:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>raspberry_jam, double_chocolate, cream_cheese, blueberry = [2.00, 2.50, 2.30, 2.10, 2.20]\nprint(blueberry)<\/pre><\/div>\n\n\n\n<p>This code unpacks our list into four variables. Each variable corresponds with a different donut. We print out the value of \u201cblueberry\u201d to the console to check if our code works. Run our code and see what happens:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Traceback (most recent call last):\n  File &quot;main.py&quot;, line 1, in &lt;module&gt;\n\traspberry_jam, double_chocolate, cream_cheese, blueberry = [2.00, 2.50, 2.30, 2.10, 2.20]\nValueError: too many values to unpack (expected 4)<\/pre><\/div>\n\n\n\n<p>We try to unpack four values, our list contains five values. Python does not know which values to assign to our variables because we are only unpacking four values. This results in an error.<br><\/p>\n\n\n\n<p>The last value in our list is the price of the chocolate donut. We solve our error by specifying another variable to unpack the list:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>raspberry_jam, double_chocolate, cream_cheese, blueberry, chocolate = [2.00, 2.50, 2.30, 2.10, 2.20]\nprint(blueberry)<\/pre><\/div>\n\n\n\n<p>Our code returns: 2.1. Our code successfully unpacks the values in our list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The \u201cvalueerror: too many values to unpack (expected 2)\u201d error occurs when you do not unpack all the items in a list.<br><\/p>\n\n\n\n<p>This error is often caused by trying to iterate over the items in a dictionary. To solve this problem, use the <code>items()<\/code> method to iterate over a dictionary.<br><\/p>\n\n\n\n<p>Another common cause is when you try to unpack too many values into variables without assigning enough variables. You solve this issue by ensuring the number of variables to which a list unpacked is equal to the number of items in the list.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to solve this Python error like a <a href=\"https:\/\/careerkarma.com\/blog\/python-projects-beginners\/\">coding ninja<\/a>! <\/p>\n","protected":false},"excerpt":{"rendered":"Python does not unpack bags well. When you see the error \u201cvalueerror: too many values to unpack (expected 2)\u201d, it does not mean that Python is unpacking a suitcase. It means you are trying to access too many values from an iterator. In this guide, we talk about what this error means and why it&hellip;","protected":false},"author":240,"featured_media":20921,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-20920","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.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python valueerror: too many values to unpack (expected 2) | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.\" \/>\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-valueerror-too-many-values-to-unpack-expected-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python valueerror: too many values to unpack (expected 2) Solution\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/\" \/>\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-08-07T08:13:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:57:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-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-valueerror-too-many-values-to-unpack-expected-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python valueerror: too many values to unpack (expected 2) Solution\",\"datePublished\":\"2020-08-07T08:13:42+00:00\",\"dateModified\":\"2023-12-01T11:57:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/\"},\"wordCount\":880,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/hack-capital-uv5_bsypFUM-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/\",\"name\":\"Python valueerror: too many values to unpack (expected 2) | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/hack-capital-uv5_bsypFUM-unsplash.jpg\",\"datePublished\":\"2020-08-07T08:13:42+00:00\",\"dateModified\":\"2023-12-01T11:57:22+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/hack-capital-uv5_bsypFUM-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/hack-capital-uv5_bsypFUM-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-valueerror-too-many-values-to-unpack-expected-2\\\/#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 valueerror: too many values to unpack (expected 2) Solution\"}]},{\"@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\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"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 valueerror: too many values to unpack (expected 2) | Career Karma","description":"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.","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-valueerror-too-many-values-to-unpack-expected-2\/","og_locale":"en_US","og_type":"article","og_title":"Python valueerror: too many values to unpack (expected 2) Solution","og_description":"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.","og_url":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-08-07T08:13:42+00:00","article_modified_time":"2023-12-01T11:57:22+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-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-valueerror-too-many-values-to-unpack-expected-2\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python valueerror: too many values to unpack (expected 2) Solution","datePublished":"2020-08-07T08:13:42+00:00","dateModified":"2023-12-01T11:57:22+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/"},"wordCount":880,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/","url":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/","name":"Python valueerror: too many values to unpack (expected 2) | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-unsplash.jpg","datePublished":"2020-08-07T08:13:42+00:00","dateModified":"2023-12-01T11:57:22+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn about the Python valueerror: too many values to unpack (expected 2) error, how the error works, and how to solve the error.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/hack-capital-uv5_bsypFUM-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/#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 valueerror: too many values to unpack (expected 2) Solution"}]},{"@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\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","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\/20920","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=20920"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/20920\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/20921"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=20920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=20920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=20920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}