Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7535153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:14:37+00:00 2026-05-30T06:14:37+00:00

Pretty simple code, I have a tuple extraAccessions with two values, a string and

  • 0

Pretty simple code, I have a tuple extraAccessions with two values, a string and a list. I want to loop through the extraAccessions (which is only one in this example) and use the first and second values in the tuple.

extraAccessions=('MS:1000505',['value','unitName'])
for accession, fieldIdentifiers in extraAccessions:
    [do something]

However, this gives

ValueError: too many values to unpack

When I do

print (extraAccessions)

I get

('MS:1000505', ['value', 'unitName'])

Which seems two values to me, exactly what is asked in

for accession, fieldIdentifiers in extraAccessions:

So I don’t see why I get this error.


edit:

And when I do

for accession in extraAccessions:
     print accession

I get the first element MS:1000505

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:14:38+00:00Added an answer on May 30, 2026 at 6:14 am

    Let’s examine your code:

    extraAccessions=('MS:1000505',['value','unitName'])
    for accession, fieldIdentifiers in extraAccessions:
        ...
    

    Here, you are iterating over the tuple (extraAccessions) that has two entries:

    1. 'MS:1000505'
    2. ['value','unitName']

    You’re then trying to unpack each entry in turn into the two variables. This doesn’t work for the first entry since it is not of length two.

    If you’re looking to unpack the two entries into the two variables, simply use:

    accession, fieldIdentifiers = extraAccessions
    

    That will set

    1. accession to 'MS:1000505'
    2. fieldIdentifiers to ['value','unitName']
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some pretty simple Java code in which I'm starting another process and
I have a pretty simple AJAX and PHP code. While calling the PHP through
My question is pretty simple: If you have two web-application components: Server-side (secret-capable) code
I have a pretty simple block of C# code here... static void ReadMSOfficeWordFile(string file)
Pretty simple. What is the difference among those three? I want to list every
Should be pretty simple: I have an InputStream where I want to peek at
I have pretty simple code <input type=hidden name=passtophp value=variable> The variable is created in
I have the following piece of code, executing a pretty simple MySQL query: $netnestquery
I have an ASP.NET MVC application which is pretty simple so far, but I
I have a pretty simple user control that I want to bind a ScaleTransform

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.