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

posixpath.getsize

Prev: posixpath.getmtime | Up: posixpath | Next: posixpath.isabs
Rel: posixpath.abspath, posixpath.basename, posixpath.commonpath, posixpath.commonprefix
Ref: docs.python.org — posixpath.getsize
Tags: #public #python3 #stdlib #posixpath


Import

import posixpath
from posixpath import getsize

Signature & Overview

posixpath.getsize(filename)

Return the size of a file, reported by os.stat().

Usage

import posixpath
from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as tmp:
    p = Path(tmp) / 'x.bin'
    p.write_bytes(b'123')
    assert posixpath.getsize(p) == 3

Gotchas

REPL Inspect

from posixpath import getsize
help(getsize)

Linked from

Related notes