Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [DIR]
- DirTo=D:AshishJab Tak hai Jaan
- DirBackup = D:ParserERICSSON_CSCORE_STANDARD_VMSBackup
- ErrorDir = D:ParserERICSSON_CSCORE_STANDARD_VMSError
- CombinerDir = D:ParserERICSSON_CSCORE_STANDARD_VMSCombiner
- DirFrom=D:ParserERICSSON_CSCORE_STANDARD_VMSIn
- PidFileDIR = D:ParserERICSSON_CSCORE_STANDARD_VMSPid
- LogDir = D:ParserERICSSON_CSCORE_STANDARD_VMSLog
- TempDir = D:ParserERICSSON_CSCORE_STANDARD_VMSTemp
- def changeINIfile():
- config=ConfigParser.RawConfigParser(allow_no_value=False)
- config.optionxform=lambda option: option
- cfgfile=open(r"D:ParserERICSSON_CSCORE_STANDARD_VMSWindowsopx_PAR_GEN_660_ERICSSON_CSCORE_STANDARD_PM_VMS_MALAYSIA.ini","w")
- config.set('DIR','DirTo','D:AshishJab Tak hai Jaan')
- config.optionxform=str
- config.write(cfgfile)
- cfgfile.close()
- def write(self, fp):
- """Write an .ini-format representation of the configuration state."""
- if self._defaults:
- fp.write("[%s]n" % DEFAULTSECT)
- for (key, value) in self._defaults.items():
- fp.write("%s = %sn" % (key, str(value).replace('n', 'nt')))
- fp.write("n")
- for section in self._sections:
- fp.write("[%s]n" % section)
- for (key, value) in self._sections[section].items():
- if key != "__name__":
- fp.write("%s = %sn" %
- (key, str(value).replace('n', 'nt')))
- fp.write("n")
- def remove_whitespace_from_assignments():
- separator = "="
- config_path = "config.ini"
- lines = file(config_path).readlines()
- fp = open(config_path, "w")
- for line in lines:
- line = line.strip()
- if not line.startswith("#") and separator in line:
- assignment = line.split(separator, 1)
- assignment = map(str.strip, assignment)
- fp.write("%s%s%sn" % (assignment[0], separator, assignment[1]))
- else:
- fp.write(line + "n")
- 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( " = ", "=" ) )
- config.write( EqualsSpaceRemover( cfgfile ) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement