By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,198 Members | 963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,198 IT Pros & Developers. It's quick & easy.

difflib confusion

P: n/a
hello all,
I have a bit of a confusing question.
firstly I wanted a library which can do an svn like diff with two files.
let's say I have file1 and file2 where file2 contains some thing which
file1 does not have. now if I do readlines() on both the files, I
have a list of all the lines.
I now want to do a diff and find out which word is added or deleted or changed.
and that too on which character, if not at least want to know the word
that has the change.
any ideas please?
kk
Jan 22 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jan 22, 6:57*pm, "krishnakant Mane" <researchb...@gmail.comwrote:
hello all,
I have a bit of a confusing question.
firstly I wanted a library which can do an svn like diff with two files.
let's say I have file1 and file2 where file2 contains some thing which
file1 does not have. *now if I do readlines() on both the files, I
have a list of all the lines.
I now want to do a diff and find out which word is added or deleted or changed.
and that too on which character, if not at least want to know the word
that has the change.
any ideas please?
Have a look at difflib in the standard library.

--
Paul Hankin
Jan 22 '08 #2

P: n/a
On 23/01/2008, Paul Hankin <pa*********@gmail.comwrote:
On Jan 22, 6:57 pm, "krishnakant Mane" <researchb...@gmail.comwrote:
hello all,
I have a bit of a confusing question.
firstly I wanted a library which can do an svn like diff with two files.
let's say I have file1 and file2 where file2 contains some thing which
file1 does not have. now if I do readlines() on both the files, I
have a list of all the lines.
I now want to do a diff and find out which word is added or deleted or
changed.
and that too on which character, if not at least want to know the word
that has the change.
any ideas please?

Have a look at difflib in the standard library.
I am aware of the difflib library but still can't figure out.
I know that differences in two lines can be got but how to get it between words?
regards,
Krishna
--
Paul Hankin
--
http://mail.python.org/mailman/listinfo/python-list
Jan 23 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.