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
This should work as you wish:
file(filename_out, "w").write(file(filename_in).read().strip())
EDIT: Although previous code works in python 2.x, it does not work python 3 (see @gnibbler comment) For both version use this:
open(filename_out, "w").write(open(filename_in).read().strip())