Hi
I've a question to compare 2 files.
My first file 'file_new' contain:
My file_new contain "reality" now.
So my script is
- To put them on a new file?
- To put them in an array / temporary json?
I'm doing some tests and reading docs but for the moment not concluant.
Thanks for ideas and help
Alex
I've a question to compare 2 files.
My first file 'file_new' contain:
Output:1
2
3
5
6
7
My second file 'file_old' contains:Output:1
2
3
4
5
6
I want to compare these two files.My file_new contain "reality" now.
So my script is
#!/usr/bin/env python3 import difflib file_old = "/tmp/file_old" file_new = "/tmp/file_new" diff = difflib.ndiff(open(file_old).readlines(),open(file_new).readlines()) print (''.join(diff))Result is:
Output: 1
2
3
- 4
5
6
+ 7
Is there any mean to retrieve simply - and + values?- To put them on a new file?
- To put them in an array / temporary json?
I'm doing some tests and reading docs but for the moment not concluant.
Thanks for ideas and help
Alex