用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。