Environment vars

Eryk Sun eryksun at gmail.com
Wed Nov 25 14:43:35 EST 2020


On 11/25/20, Bob van der Poel <bob at 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".


More information about the Python-list mailing list