我有两个不同语言的文本文件,它们逐行对齐。也就是说,textfile1中的第一行对应于textfile2中的第一行,依此类推。
有没有一种方法可以同时按行读取这两个文件?
以下是文件样例,假设每个文件大约有100万行。
textfile1:
This is a the first line in English
This is a the 2nd line in English
This is a the third line in English
文本文件2:
C'est la première ligne en Français
C'est la deuxième ligne en Français
C'est la troisième ligne en Français
期望的输出
This is a the first line in English\tC'est la première ligne en Français
This is a the 2nd line in English\tC'est la deuxième ligne en Français
This is a the third line in English\tC'est la troisième ligne en Français
这里有一个 Java 版本的同时逐行读取两个文本文件的方法 -Java,但是 Python 没有使用可逐行读取的缓冲区读取器,那么该如何实现呢?