reading and writing files

Chris Rebert clp2 at rebertia.com
Wed Aug 24 06:43:41 CEST 2011


On Tue, Aug 23, 2011 at 9:05 PM, Dave Angel <davea at ieee.org> wrote:
> On 01/-10/-28163 02:59 PM, Adrián Monkas wrote:
<snip>
>>             print "Abro Archivo Origen"
>>             archivo=open("D:\Boot.txt","r")
<snip>
> Your filenames are incorrect, since you use the backslash without escaping
> it.  So the source file has a backspace in it.  I'm amazed you don't get an
> error, since it's unlikely you have a file with that kind of name.

Backslash escape sequences only work for lowercase characters:
>>> '\b'
'\x08'
>>> '\B'
'\\B'

But yeah, I don't endorse relying on this.

Just use forward slashes instead of backslashes in paths; Windows
accepts them just fine.

Cheers,
Chris
--
http://rebertia.com



More information about the Python-list mailing list