同时打开三个文件,文件行数一样,要求实现每个文件依次读取一行,然后输出,我们先来看比较容易想到的写法: with open(filename1, 'rb') as f1: with open(filename2, 'rb') as f2: with open(filename3, 'rb') as f3: for i in f1: j = f2.readline() k = f3.readline() print(i, j, k) 注意这里只能对单个文件进行for循环读取,不能写成: for i…