File names with slashes [was Re: error in os.chdir]
eryk sun
eryksun at gmail.com
Sun Jul 1 12:36:25 EDT 2018
On Sun, Jul 1, 2018 at 4:00 PM, Abdur-Rahmaan Janhangeer
<arj.python at gmail.com> wrote:
> one common scenario is
>
> C:\Users\....
>
> where \U is taken as a unicode litteral
This one is especially annoying in Python 2, since it makes raw
unicode strings useless for common path literals. For example:
>>> ur'C:\Users'
File "<stdin>", line 1
SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode
bytes in position 2-3: truncated \uXXXX
>>> ur'C:\users'
File "<stdin>", line 1
SyntaxError: (unicode error) 'rawunicodeescape' codec can't decode
bytes in position 2-3: truncated \uXXXX
Python 2 raw strings are half-baked.
More information about the Python-list
mailing list