looping text in file python
<p>I have 2 files i am trying to put together one has about 300 lines and the other has mabey 85.</p>

<p>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</p>

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

<p>Here are some examples of what the output looks like when it runs out of numbers</p>

<pre><code>LLOYD1999

TOMMY2000

LEON2001

DEREK2002

WARREN2003

DARRELL2004
JEROME
FLOYD
LEO
</code></pre>

<p>I want it to output like this</p>

<pre><code>LLOYD1999
LLOYD2000
LLOYD2001
LLOYD2002
LLOYD2003
LLOYD2004

TOMMY1999
TOMMY2000
TOMMY2001
TOMMY2002
TOMMY2003
TOMMY2004
ect...
</code></pre>
