I am using a file and i have one section named DIR in which it contain the paths. EX:
[DIR]
DirTo=D:\\Ashish\\Jab Tak hai Jaan
DirBackup = D:\\Parser\\ERICS
I ran into this problem to and I came up with an additional solution.
Instead I wrote a wrapper around the file object which simply replaces " = " with "=" in all lines written though it.
class EqualsSpaceRemover:
output_file = None
def __init__( self, new_output_file ):
self.output_file = new_output_file
def write( self, what ):
self.output_file.write( what.replace( " = ", "=", 1 ) )
config.write( EqualsSpaceRemover( cfgfile ) )