File names with slashes [was Re: error in os.chdir]
Gregory Ewing
greg.ewing at canterbury.ac.nz
Thu Jul 5 01:42:29 EDT 2018
Mikhail V wrote:
> There is one issue that I can't write \ on the end:
> r"C:\programs\util\"
>
> But since I know it's a path and not a file, I just write without trailing \.
Indeed. There's never a need to put a backslash on the end of
a path, as long as you always use os.path functions or
equivalent to manipulate them. Which is a good idea anyway,
since it will make things easier if anyone ever wants to
run the code on something other than Windows.
--
Greg
More information about the Python-list
mailing list