我有两种不同语言的两个文本文件,它们逐行对齐。即textfile1 中的第一行对应于textfile2 中的第一行,以此类推。
有没有办法同时逐行读取两个文件?
下面是文件应该是什么样子的示例,假设每个文件的行数约为 1,000,000。
文本文件1:
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 版本的Read two textfile 同时行 -java,但 Python 不使用逐行读取的 bufferedreader。那么它会怎么做呢?