Unicode Chars in Windows Path

Lele Gaifax lele at metapensiero.it
Fri Apr 4 03:07:39 EDT 2014


Steven D'Aprano <steve at pearwood.info> writes:

> When working with Windows paths, you should make a habit of either 
> escaping every backslash:
>
>     u"c:\\automation_common\\Python\\TestCases\\list_dir_script.txt"
>
> using a raw-string:
>
>     ur"c:\automation_common\Python\TestCases\list_dir_script.txt"
>
> or just use forward slashes:
>
>     u"c:/automation_common/Python/TestCases/list_dir_script.txt"

The latter should be preferred, in case Python3 compatibility is a goal.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list