On this page
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
- Returns file size in bytes.
REPL Inspect
from ntpath import getsize
help(getsize)
Linked from
Related notes
- tuts/python3/stdlib_module/ntpath/getmtime Linked here; links to this page; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/isabs Linked here; links to this page; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ntpath/abspath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/basename Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonpath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonprefix Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/dirname shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/exists shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/expanduser shared tags: #ntpath, #stdlib