用法:
difflib.restore(sequence, which)
返回生成增量的两个序列之一。
给定由
Differ.compare()
或ndiff()
生成的sequence
,提取源自文件 1 或 2(参数which
)的行,去除行前缀。例子:
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True), ... 'ore\ntree\nemu\n'.splitlines(keepends=True)) >>> diff = list(diff) # materialize the generated delta into a list >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu
相关用法
- Python difflib.unified_diff用法及代码示例
- Python difflib.get_close_matches用法及代码示例
- Python difflib.ndiff用法及代码示例
- Python difflib.SequenceMatcher.get_opcodes用法及代码示例
- Python difflib.context_diff用法及代码示例
- Python difflib.SequenceMatcher.find_longest_match用法及代码示例
- Python difflib.SequenceMatcher.get_matching_blocks用法及代码示例
- Python distributed.protocol.serialize.register_generic用法及代码示例
- Python dict()用法及代码示例
- Python distributed.Client.gather用法及代码示例
- Python distributed.recreate_tasks.ReplayTaskClient.recreate_task_locally用法及代码示例
- Python distributed.diagnostics.plugin.SchedulerPlugin用法及代码示例
- Python distributed.Client.ncores用法及代码示例
- Python distributed.Client.retire_workers用法及代码示例
- Python distributed.Client.unregister_worker_plugin用法及代码示例
- Python dictionary update()用法及代码示例
- Python distributed.fire_and_forget用法及代码示例
- Python dir用法及代码示例
- Python distributed.Client.set_metadata用法及代码示例
- Python distributed.Client.scheduler_info用法及代码示例
注:本文由纯净天空筛选整理自python.org大神的英文原创作品 difflib.restore。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。