If you want to remove the leading whitespace of string or trailing whitespace of string, use lstrip () or rstrip () methods. treecompare is a library for comparing trees of various objects in a way that yields useful "paths" to each difference. How to compare two files in Python line by line - Quora Hello JW, Microsoft Scripting Guy, Ed Wilson, is here. I wrote a shell script which works well most of the time. The file format used by ConfigParser is similar to the format used by older versions of Microsoft Windows. Parameters : Doesn't take any parameter, since it's not a function. compare () does a two-level matching: first, on a *line* level, considering only the linejunk parameter. ), and the parser assembles the tokens into an abstract syntax tree. How to ignore parts of your file - How Do I Use Beyond Compare ... Python accepts the control-L (i.e. The examples below will all use this common test data in the difflib_data.py module: Using the same solution but trasnpiled for Python 3. Treat json as serialized python data-structures, (and so) read in the data-structures into python and compare there 2. Python Strip() - Remove White Spaces at Start and End of String The filecmp module defines the following functions: filecmp. So case-insensitive search also returns false. when I run the .py file through . Just paste and compare. Comparing files (diff command) - IBM Compare files line by line. The tab is a whitespace character which contains multiple spaces. For example does extra/deleted non-significant white-space matter? If white space is the only difference between the two files, then you should be able to read both files into memory as strings, and then apply a regular expression to each that replaces groups of whitespace with a single space.