Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69648

Re: Unicode Chars in Windows Path

From Lele Gaifax <lele@metapensiero.it>
Subject Re: Unicode Chars in Windows Path
Date 2014-04-04 09:07 +0200
Organization Nautilus Entertainments
References <f3b4238a-6bf4-478e-9326-1ba239d5237f@googlegroups.com> <533cc967$0$2909$c3e8da3$76491128@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.8880.1396595277.18130.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano <steve@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@metapensiero.it  |                 -- Fortunato Depero, 1929.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unicode Chars in Windows Path Steve <sreisscruz@gmail.com> - 2014-04-02 16:27 -0700
  Re: Unicode Chars in Windows Path Steven D'Aprano <steve@pearwood.info> - 2014-04-03 02:37 +0000
    Re: Unicode Chars in Windows Path Chris Angelico <rosuav@gmail.com> - 2014-04-03 14:10 +1100
      Re: Unicode Chars in Windows Path Marko Rauhamaa <marko@pacujo.net> - 2014-04-03 12:00 +0300
        Re: Unicode Chars in Windows Path Peter Otten <__peter__@web.de> - 2014-04-03 15:09 +0200
        Re: Unicode Chars in Windows Path random832@fastmail.us - 2014-04-03 09:57 -0400
        Re: Unicode Chars in Windows Path Chris Angelico <rosuav@gmail.com> - 2014-04-04 01:17 +1100
        Re: Unicode Chars in Windows Path David <bouncingcats@gmail.com> - 2014-04-04 11:15 +1100
        Re: Unicode Chars in Windows Path Chris Angelico <rosuav@gmail.com> - 2014-04-04 12:16 +1100
        Re: Unicode Chars in Windows Path David <bouncingcats@gmail.com> - 2014-04-04 13:02 +1100
    Re: Unicode Chars in Windows Path Terry Reedy <tjreedy@udel.edu> - 2014-04-03 14:41 -0400
    Re: Unicode Chars in Windows Path Chris Angelico <rosuav@gmail.com> - 2014-04-04 09:06 +1100
    Re: Unicode Chars in Windows Path Lele Gaifax <lele@metapensiero.it> - 2014-04-04 09:07 +0200
  Re: Unicode Chars in Windows Path alister <alister.nospam.ware@ntlworld.com> - 2014-04-03 08:35 +0000

csiph-web