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 7993853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:58:36+00:00 2026-06-04T13:58:36+00:00

I was wondering if you guys had any input on how to efficiently go

  • 0

I was wondering if you guys had any input on how to efficiently go about doing this, I currently have a working implementation using Python’s collections class.

  • 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-04T13:58:38+00:00Added an answer on June 4, 2026 at 1:58 pm

    It depends on how much memory you have available (and the size of the files of course).

    If you have enough memory available than I’d personally just take the easy way and create a list of all items and do a sort() on them.

    Something like this:

    # Read all except the first (header) lines
    lines = file('1.txt').readlines()[1:]
    lines += file('2.txt').readlines()[1:]
    
    lines.sort(key=lambda x: int(x.split()[0]))
    
    print ''.join(lines)
    

    Alternative for the lambda:

    def key(x):
        return int(x.split()[0])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering if you guys have any good reading to consider what to
I was wondering if any of you guys had any experience generating code coverage
Hey guys! Was wondering is anyone had any suggestions on books or other resources
When reading about SQL Injection and XSS i was wondering if you guys have
Wondering what the best / good way of doing this would be in jQuery.
I was wondering if you guys could help with a complicated query. I have
I have not submitted an application yet, however am wondering if you guys could
Hi guys wondering if someone can help me, I am using the object literal
I'm currently using Spring+Hibernate+MySQL for a project I'm working on. I realized that a
I'm having this inconvenience while commenting. But I was wondering how you guys would

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.