Problems with path
Fredrik Lundh
fredrik at pythonware.com
Wed Aug 6 06:33:42 EDT 2003
"hamido" <hamido at tmsk.itm.edu.my> 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:
http://www.python.org/doc/current/tut/node5.html#SECTION005120000000000000000
http://www.python.org/doc/current/ref/strings.html
</F>
More information about the Python-list
mailing list