Returning lines that differ between two files (Python)

前端 未结 3 694
我寻月下人不归
我寻月下人不归 2021-02-06 17:38

I have two files with tens of thousands of lines each, output1.txt and output2.txt. I want to iterate through both files and return the line (and content) of the lines that diff

3条回答
  •  暖寄归人
    2021-02-06 17:55

    7.4. difflib — Helpers for computing deltas

    New in version 2.1.

    This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce difference information in various formats, including HTML and context and unified diffs. For comparing directories and files, see also, the filecmp module.

提交回复
热议问题