Compare File with ignore some line/last line
There is no need for python here, you can use the head command to filter out the last line of a file:

diff &lt;(head -n -1 "Golden_File") &lt;(head -n -1 "cp.log")