Does This Scare You?

Michael Torrie torriem at gmail.com
Sun Aug 21 16:03:18 EDT 2016


On 08/19/2016 05:42 PM, Lawrence D’Oliveiro wrote:
>     Python 3.5.2+ (default, Aug  5 2016, 08:07:14) 
>     [GCC 6.1.1 20160724] on linux
>     Type "help", "copyright", "credits" or "license" for more information.
>     >>> from pathlib import PureWindowsPath
>     >>> PureWindowsPath("prn").is_reserved()
>     True
>     >>> PureWindowsPath("prn.doc").is_reserved()
>     True
>     >>> PureWindowsPath("com9.exe").is_reserved()
>     True
>     >>> PureWindowsPath("c:/my documents/prn.doc").is_reserved()
>     True

Which part are you getting at?  That Windows treats certain filenames as
reserved (a known gotcha that has existed for decades) or that Python
allows you to test whether a path is valid in Windows?




More information about the Python-list mailing list