Adder timer to 1 of these columns

I have 2 files that print on the same line at the same time. I wanted to add time.sleep() to 1 of the textfiles. I wanted to delay the time that 1 textfile prints with the other 1 in this script. I wanted to have the files to create new lines instead of printing the same combinations when they both print. Where to add the time.sleep()?

from itertools import izip_longest
import time

with open("file1") as textfile1, open("file2") as textfile2:
for x, y in izip_longest(textfile1, textfile2, fillvalue=""):
    x = x.strip()
    y = y.strip()
    print("{0}{1}".format(x, y))

What is your question, exactly?

I have 2 files that print on the same line at the same time. I wanted to add time.sleep() to 1 of the textfiles. I wanted to delay the time that 1 textfile prints with the other 1 in this script. I wanted to have the files to create new lines instead of printing the same combinations when they both print.

Yes, I read that.

What is your question exactly.

You have not asked a question. You have only stated what you "want"... that is not a question.

Try asking a question :slight_smile:

Where to add the time.sleep()?

Example:

#!/usr/bin/python
import time
print "Start : %s" % time.ctime()
time.sleep( 1 )
print "End : %s" % time.ctime()

You can add time.sleep( 1 ) after import time in your script.