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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:15:21+00:00 2026-05-25T21:15:21+00:00

I have 2 files i am trying to put together one has about 300

  • 0

I have 2 files i am trying to put together one has about 300 lines and the other has mabey 85.

I want to have the file with 85 to loop until it adds a line of text onto each of the other files lines.
Here is my code i put together so far

name_file = open("names.txt", "r")
year_file = open("years.txt", "r")
for line in name_file:
    print line.strip()+(year_file.readline())

Here are some examples of what the output looks like when it runs out of numbers

LLOYD1999

TOMMY2000

LEON2001

DEREK2002

WARREN2003

DARRELL2004
JEROME
FLOYD
LEO

I want it to output like this

LLOYD1999
LLOYD2000
LLOYD2001
LLOYD2002
LLOYD2003
LLOYD2004

TOMMY1999
TOMMY2000
TOMMY2001
TOMMY2002
TOMMY2003
TOMMY2004
ect...
  • 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-25T21:15:22+00:00Added an answer on May 25, 2026 at 9:15 pm
    with open('years.txt') as year:
        years = [yr.strip() for yr in year]
    with open('names.txt') as names:
        for name in names:
            name = name.strip()
            for year in years:
                print("%s%s" % (name, year))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to put together a really simple module with one .py source file
Here I am trying to implement the jQuery I have two main files one
I'm trying to pass files one by one(I have to dot that since executable
I am trying to understand the Python ctypes module. I have put together a
If I have output from two sources that I want to put together on
So I have a view that I have put together in another .xib file.
I have some big .csv files and I am trying to put it into
I've been trying to put together a gui in MATLAB and have had great
I have put together an example bit of code as I am trying to
I'm trying to shred XML files that have an unusual layout, because items are

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.