On Wed, Nov 25, 2020 at 12:43 PM Eryk Sun <eryk...@gmail.com> wrote: > On 11/25/20, Bob van der Poel <b...@mellowood.ca> wrote: > > I've got a program which accepts an optional env variable listing a > single > > or multiple directory for the app to use. > > In Unix one would use colon as the preferred delimiter. In Windows, > it's a semicolon because DOS paths use colon to designate drives. > Python makes the platform's preferred path delimiter available as > os.pathsep. > > A bonus with using semicolon in Windows 10 is that the system > environment variable editor implements a multi-line form to edit the > value if it detects a drive-like path as the first item. For example, > editing "MYPATH=Z:\Spam;foo;bar" splits the value into three > single-line text-edit fields containing "Z:\Spam", "foo", and "bar". >
Ahha! Didn't know about os.pathsep. Seems simple enough to use that and be done with it. I'm just using str.split() just now. Is there a os.splitpath()? I don't see anything in the docs. -- https://mail.python.org/mailman/listinfo/python-list