On 11/25/20, Bob van der Poel <b...@mellowood.ca> wrote: > > 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.
There are no platform standard rules to follow when splitting a path list. A string split() on os.pathsep suffices. If you don't have a special use for empty entries, you can filter the result with a list comprehension, e.g. [p for p in (os.environ.get('MYPATH') or default).split(os.pathsep) if p]. The `default` value here is for when MYPATH isn't defined or has an empty-string value. -- https://mail.python.org/mailman/listinfo/python-list