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

  • SEARCH
  • Home
  • 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 9166379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:08:23+00:00 2026-06-17T15:08:23+00:00

Many thanks to the SO community for helping me with the previous problems I

  • 0

Many thanks to the SO community for helping me with the previous problems I had encountered. Love the help here!

I have yet another problem now. I have a flat list of DNA sequences that have associated “Construct Number” and “Part Number. As things stand right now, from my previous code, I have it as a csv file which I open up, read in, and import as a list of dictionary objects. Everything is sorted by “Construct Number” already, but I need to then sort by “Part Number”. (It’s sort of like in Excel, where they say “First sort by and then sort by _.”

Does anybody know how to get this done? Thus far, all I have written is this:

primers_list = open('primers-list.csv', 'rU')
primers_unsorted = csv.DictReader(primers_list)
for row in primers_unsorted:
    print(row)

A subset of the output thus far is just the following, for visualization of the data I’m working with:

{' Direction': 'fw primer', ' Construct Number': '1', ' Part Number': '2', 'Primer Sequence': 'AAGCGGCCGCTCGAGTCTAAgctcactcaaaggcggtaatcagataaaaaaaatccttag'}
{' Direction': 're primer', ' Construct Number': '1', ' Part Number': '1', 'Primer Sequence': 'attaccgcctttgagtgagcTTAGACTCGAGCGGCCGCTTTTTGACACCAGACCAACTGG'}
{' Direction': 'fw primer', ' Construct Number': '1', ' Part Number': '1', 'Primer Sequence': 'TTTAATTACTAACTTTATCTATGATAGATCCCGTCGTTTTACAACGTCGTGACTGGGAAA'}
{' Direction': 're primer', ' Construct Number': '1', ' Part Number': '2', 'Primer Sequence': 'AAAACGACGGGATCTATCATAGATAAAGTTAGTAATTAAACTTAAAAGTTGTTTAATGTC'}
{' Direction': 'fw primer', ' Construct Number': '2', ' Part Number': '2', 'Primer Sequence': 'gtaaatccaagttgtaataatactagagTAGCATAACCCCTTGGGGCCTCTAAACGGGTC'}
{' Direction': 're primer', ' Construct Number': '2', ' Part Number': '1', 'Primer Sequence': 'GGGGTTATGCTActctagtattattacaacttggatttaccacctttcttcgccttgatc'}
{' Direction': 'fw primer', ' Construct Number': '2', ' Part Number': '1', 'Primer Sequence': 'TACGACTCACTATAGGGAGAtactagagttaaggaggtaaaaaaaatgggtccggtcgtt'}
{' Direction': 're primer', ' Construct Number': '2', ' Part Number': '2', 'Primer Sequence': 'ttacctccttaactctagtaTCTCCCTATAGTGAGTCGTATTACTCTAGAAGCGGCCGCg'}
{' Direction': 'fw primer', ' Construct Number': '3', ' Part Number': '2', 'Primer Sequence': 'gtaaatccaagttgtaataatactagagTAGCATAACCCCTTGGGGCCTCTAAACGGGTC'}
{' Direction': 're primer', ' Construct Number': '3', ' Part Number': '1', 'Primer Sequence': 'GGGGTTATGCTActctagtattattacaacttggatttaccacctttcttcgccttgatc'}
{' Direction': 'fw primer', ' Construct Number': '3', ' Part Number': '1', 'Primer Sequence': 'TAACTATCACTATAGGGAGAtactagagttaaggaggtaaaaaaaatgggtccggtcgtt'}
{' Direction': 're primer', ' Construct Number': '3', ' Part Number': '2', 'Primer Sequence': 'ttacctccttaactctagtaTCTCCCTATAGTGATAGTTATTACTCTAGAAGCGGCCGCg'}
  • 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-06-17T15:08:25+00:00Added an answer on June 17, 2026 at 3:08 pm

    Another way:

    import operator
    primers_unsorted.sort(key=operator.itemgetter(' Construct Number', ' Part Number'))
    
    for row in primers_unsorted:
        print(row)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks to many people on the community of SO I have been trying to
Many thanks for the advice you have given me thus far. Using testbenches is
I have some jQuery code contributed by another member of the stack overflow community
Let me thanks you guys at the Stack Overflow community for helping me with
First off, let me thank the SO community for helping me so many times
I have encountered many different ways to turn a Java program into a Windows
I have been asking the community alot for help and i appreciate it all
Since I'm sure many people have different standard, I've made this post a community
Following on from my earlier question about creating Address Books (many thanks Peter!), I
Well to me Perl sometimes looks abit Abracadabra so many thanks for the patience

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.