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
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)
Built Distribution
Close
Hashes for what_the_diff-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d07f4615777b579ebdb050e2339d260c5e1022640a17f2c81f811c4aadf4a656 |
|
MD5 | 9a9d5ab760571d815709303add830b0b |
|
BLAKE2b-256 | 5153f71016a13ef2a2be93644c1357f3d659ae23b47d5f9868d9dfdd02c6b117 |