Why exception from os.path.exists()?

Chris Angelico rosuav at gmail.com
Sun Jun 10 16:10:26 EDT 2018


On Mon, Jun 11, 2018 at 12:45 AM, Bev in TX <countryone77 at gmail.com> wrote:
>>  * One with an embedded / in the file name
>
> This is easily done in Finder, where I created a folder named "my/slash”.
> When I list it at the command line in Terminal, this shows up as "my:slash”, with the slash shown as a colon.
> If I create a file with a colon in its name at the command line, that file name acts the same way:
>
> $ touch ‘my:colon"
> $ ls
> my:colon
> my:slash
>
> In Finder they both display as:
> my/colon
> my/slash
>
> However, if you use Finder’s “Copy item as Pathname” option, then you will again see the colon.
>
> /Users/bev/Training/myPython/pygroup/files/my:colon
> /Users/bev/Training/myPython/pygroup/files/my:slash
>
> But if you paste that folder’s name in Finder’s “Go to Folder” option, it converts it to the following, and goes to that folder:
>
> /Users/bev/Training/myPython/pygroup/files/my/slash/slash

Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
I'd like to see what their file names are represented as.

ChrisA



More information about the Python-list mailing list