I have a file which contains a value 2000,00.
But it contains spaces after 2000,00 and empty lines.
I want to remove all the spaces and empty lines, if some
Change your 'lines' line to use the following generator and it should do the trick.
lines = (line.strip() for line in fh.readlines() if len(line.strip()))