From a75e7635d5b39e17d8d3158a04bbcc9807a0eded Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Fri, 19 Apr 2019 12:09:11 +0300 Subject: [PATCH] Add os.sep --- Lib/os.py | 5 +++++ tests/snippets/stdlib_os.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Lib/os.py b/Lib/os.py index 8c19a89c6..3cadb5f61 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -1,5 +1,10 @@ from _os import * +if name == 'nt': + sep = '\\' +else: + sep = '/' + # Change environ to automatically call putenv(), unsetenv if they exist. from _collections_abc import MutableMapping diff --git a/tests/snippets/stdlib_os.py b/tests/snippets/stdlib_os.py index 7b9981bdf..6552596d7 100644 --- a/tests/snippets/stdlib_os.py +++ b/tests/snippets/stdlib_os.py @@ -58,3 +58,8 @@ if os.name == "posix": os.putenv(ENV_KEY, ENV_VALUE) os.unsetenv(ENV_KEY) assert os.getenv(ENV_KEY) == None + +if os.name == "nt": + assert os.sep == "\\" +else: + assert os.sep == "/"