python - 有人可以解释 DiffLib 库吗?

标签 python difflib

根据此处的 Python 文档:https://docs.python.org/2/library/difflib.html ,当我比较两个序列时,如果该行对于序列 1 是唯一的,则会附加“+”,对于序列 2 则附加“-”。 '?当任一输入序列中都不存在该行时,会附加 '。这是什么意思?有人可以向我解释一下什么时候出现“?”吗?已附加?

最佳答案

在您链接的文档的同一部分:

Lines beginning with ‘?‘ attempt to guide the eye to intraline differences, and were not present in either input sequence.

这仅用于可视化目的。

关于python - 有人可以解释 DiffLib 库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35979482/

相关文章:

python - 如何在 qpython3(python 的 Android 端口)上安装模块

python - 子集 Pandas Dataframe 一切都是最新的

Eclipse/Aptana 中的 Python OpenGL

python - 在 python 中声明文件夹路径的正确方法是什么?

python - 按时间对元组列表进行排序

python - 在 Python 中将文件和差异合并到一个新文件中

python - 考虑删除获取接近的字符串匹配 - python

Python:在 difflib 中传递 SequenceMatcher "autojunk=False"标志会产生错误

带有正则表达式的 Python difflib

Python difflib.get_close_matches 搜索字典值 - 如何返回 key ?