[pyar] evitar espacios en ConfigParser
Fernando Toledo
ftoledo en docksud.com.ar
Dom Mar 17 02:43:27 ART 2013
Hola gente!
¿Alguien sabe si hay forma de evitar que ConfigParser me guarde los
valores sin los espacios entre la opcion y el valor
opcion = valor
y yo quiero
opcion=valor
codigo:
s = 'Default Applications'
f = '/usr/share/applications/defaults.list'
cfg = ConfigParser.RawConfigParser()
cfg.read(f)
if not cfg.has_section(s):
cfg.add_section(s)
cfg.set(s,'application/png','eom.desktop')
with open(f, 'wb') as configfile:
cfg.write(configfile)
archivo original:
[Default Applications]
application/vnd.google-earth.kml+xml=google-earth.desktop
application/vnd.google-earth.kmz=google-earth.desktop
application/earthviewer=google-earth.desktop
application/keyhole=google-earth.desktop
despues de modificarlo:
[Default Applications]
application/vnd.google-earth.kml+xml = google-earth.desktop
application/vnd.google-earth.kmz = google-earth.desktop
application/earthviewer = google-earth.desktop
application/keyhole = google-earth.desktop
application/png = eom.desktop
--
Fernando Toledo
Dock Sud BBS
http://bbs.docksud.com.ar
telnet://bbs.docksud.com.ar
More information about the pyar
mailing list