you could always just remove those special characters (\n \t ..), remove spaces, read both files and compare string. I don't this is the best way of doing this... but maybe a combination of this way and yours will be efficient enough - remove all problematic characters and then compare line by line.
good luck... -- http://mail.python.org/mailman/listinfo/python-list