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

ntpath.getsize

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


Import

import ntpath
from ntpath import getsize

Signature & Overview

ntpath.getsize(filename)

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

Usage

import ntpath
from pathlib import Path
import tempfile

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

Gotchas

REPL Inspect

from ntpath import getsize
help(getsize)

Linked from

Related notes