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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file what_the_diff-0.1.tar.gz.
File metadata
- Download URL: what_the_diff-0.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0841340cbbe1486e27521b4cdab97c8e5ab265a61bfde780644d57f5cd23e83
|
|
| MD5 |
d2f885621be57a332922b342ebe6347e
|
|
| BLAKE2b-256 |
12dfd8b0812010dc21cdfb92486f6dff21e6915c56998b1ff5f32d8b3ad9d256
|
File details
Details for the file what_the_diff-0.1-py3-none-any.whl.
File metadata
- Download URL: what_the_diff-0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d07f4615777b579ebdb050e2339d260c5e1022640a17f2c81f811c4aadf4a656
|
|
| MD5 |
9a9d5ab760571d815709303add830b0b
|
|
| BLAKE2b-256 |
5153f71016a13ef2a2be93644c1357f3d659ae23b47d5f9868d9dfdd02c6b117
|