我有 2 个文件同时打印在同一行。我想将 time.sleep() 添加到 1 个文本文件中。我想延迟此脚本中 1 个文本文件与其他 1 个文本文件打印的时间。我想让文件创建新行,而不是在它们都打印时打印相同的组合。在哪里添加 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))
扬帆大鱼
人到中年有点甜
相关分类