On this page
posixpath.sameopenfile
Prev: posixpath.samefile | Up: posixpath | Next: posixpath.samestat
Rel: posixpath.abspath, posixpath.basename, posixpath.commonpath, posixpath.commonprefix
Ref: docs.python.org — posixpath.sameopenfile
Tags: #public #python3 #stdlib #posixpath
Import
import posixpath
from posixpath import sameopenfile
Signature & Overview
posixpath.sameopenfile(fp1, fp2)
Test whether two open file objects reference the same file
Usage
import posixpath, tempfile
with tempfile.TemporaryFile() as f:
assert posixpath.sameopenfile(f.fileno(), f.fileno()) is True
Gotchas
- Takes two integer file descriptors.
REPL Inspect
from posixpath import sameopenfile
help(sameopenfile)
Linked from
Related notes
- tuts/python3/stdlib_module/posixpath/samefile Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/samestat Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posixpath/abspath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/basename Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonpath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonprefix Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/dirname shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/exists shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/expanduser shared tags: #posixpath, #stdlib