Skip to content

dingyaguang117/PyDiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PyDiff

A library to diff two files, output is unified format

example:

import pydiff

a = '''a
a
b
c
d
e'''

b = '''b
b
b
c
d
d
e'''

def main():
    result =  pydiff.diff(a,b)
    for one in result:
        if one.status == -1:
            print '-',one.val
        elif one.status == 1:
            print '+',one.val
        else:
            print ' ',one.val

if __name__ == '__main__':
    main()

output
------
- a
- a
+ b
+ b
  b
  c
+ d
  d
  e

About

A library to diff two files, output is unified format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages