Skip to main content

Unix diff implementation in python

Project description

what-the-diff

"What the diff???"

unix diff implementation in python

Usage

from what_the_diff import diff
old = "Hello world\nHello hell"

new = "Hello Heaven\nHello world\nHello hall\nHello waddldo"

lines_new = new.split('\n')
lines_old = old.split('\n')


removed, added, updated = diff(old, new)

for i in removed:
    print(i.format())
for i in added:
    print(i.format())
for i in updated:
    print(i.format())

#prints
#0,1d1
#< Hello hell
#0a1,1
#> Hello Heaven
#2a3,4
#> Hello hall
#> Hello waddldo
#1c2
#< Hello hell
#---
#> Hello hall
#### With colors

Install

pip install what-the-diff

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

what_the_diff-0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

what_the_diff-0.1-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page