You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2010-04-29.18:09:38.308>created_at=<Date2009-06-18.10:36:13.071>labels= ['type-feature', 'library']
title='filecmp.cmp can not compare two files from different OS with the same content'updated_at=<Date2010-04-29.18:09:38.307>user='https://bugs.python.org/higer'
I just want to compare two files,one from windows and the other from
unix. But I do not want to compare them through reading them line by
line. Then I found there is a filecmp module which is used as file and
directory comparisons. However,when I use two same files (one from
unix,one from windows,the content of them is the same) to test its cmp
function, filecmp.cmp told me false.
Later, I found that windows use '\n\r' as new line flag but unix use
'\n', so filecmp.cmp think that they are different,then return false.
I think maybe it's a bug.
If filecmp.cmp can support two platform files with the same content
and only the diffrent last newline flag, that's would be wonderful.
If you do not want to compare them by reading line by line, then you are
doing a binary comparison (which is what filecmp does) and the two files
are, indeed, different. If you want to compare them in text mode, you
are moving into 'diff' territory and could use difflib instead.
If you nevertheless want to propose an additional
text-and-universal-newline-mode version of cmp (it would be best if you
were prepared to write the patch), please bring it up on python-ideas
for community discussion, as it is not clear that it is a good idea. If
you get a consensus that it is a good idea you can reopen this ticket
with a pointer to the discussion.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: