python3里面比较两个字符串的不同【difflib】
一、difflib库的用法
a = '/Users/melon/Desktop/odoo14/myaddons/watermark_design/fonts/SimSun.ttf' b = '/Users/melon/Desktop/odoo14/myaddons/watermark_design/models/fonts/SimSun.ttf' from difflib import Differ d = Differ() diff = d.compare(a.splitlines(), b.splitlines()) print('\n'.join(list(diff)))
心有猛虎,细嗅蔷薇