When writing text. . .

barberomarcelo at gmail.com barberomarcelo at gmail.com
Fri Jul 14 20:06:10 EDT 2006


Or:

win.write(r'run=C:\windows\aawin.bat')

The r before the string makes it a "raw" string, where \ are not
interpreted as escape characters.

Marcelo

Daniel Nogradi ha escrito:

> > Hey I'm pretty new to python and I have a question.  I'm trying to write:
> > "[BOOT]
> > run=C:\windows\aawin.bat"
> >
> > in my win.ini
> > So I went about it like this:
> >
> > win = open('C:\windows\win.ini', 'a')
> > win.write('[BOOT]')
> > win.write('\n')
> > win.write('run=C:\windows\aawin.bat')
> >
> > I expected that to work, but instead of C:\windows\aawin.bat I get
> > run=C:\windowsawin.bat. . .
> > I assume /a is a code for  like /n is for a newline, is there a way to fix
> > this?
> 
> win.write( '\\a' )




More information about the Python-list mailing list