Problems with path

Fredrik Lundh fredrik at
Wed Aug 6 12:33:42 CEST 2003

"hamido" <hamido at> wrote:

> Why this statement will generate errors
>  shutil.copy2("c:\hamido.sql", "c:\ali1.ali")
>  shutil.copy2('c:\hamido.sql', 'c:\ali1.ali')

because "\a" is a character escape (ascii code 7), not a
backslash followed by an "a".

three solutions:

- use forward slashes instead ("c:/ali1.ali")
- double the backslashes ("c:\\ali1.ali")
- use "raw" strings (r"c:\ali1.ali")

to get the full story, check the section on strings in your favourite
python book, or read the on-line manual:


More information about the Python-list mailing list