On this page
  1. os.getcwd
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

os.getcwd

Prev: os.fspath | Up: os | Next: os.getenv
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org — os.getcwd
Tags: #public #python3 #stdlib #os


Import

import os
from os import getcwd

Signature & Overview

os.getcwd()

Return a unicode string representing the current working directory.

Usage

import os

cwd = os.getcwd()
assert isinstance(cwd, str) and len(cwd) > 0

Gotchas

REPL Inspect

from os import getcwd
help(getcwd)

Linked from

Related notes