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))
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.