How to get the PATH environment-variable separator in Python?

前端 未结 5 878
粉色の甜心
粉色の甜心 2020-12-02 12:43

When multiple directories need to be concatenated, as in an executable search path, there is an os-dependent separator character. For Windows it\'s \';\', for

5条回答
  •  悲哀的现实
    2020-12-02 13:30

    OK, so there are:

    • os.pathsep that is ; and which is a separator in the PATH environment variable;
    • os.path.sep that is / in Unix/Linux and \ in Windows, which is a separator between path components.

    The similarity is a source of confusion.

提交回复
热议问题