genericpath.sameopenfile
Prev: genericpath.samefile | Up: genericpath | Next: genericpath.samestat
Rel: genericpath.commonprefix, genericpath.exists, genericpath.getatime, genericpath.getctime
Ref: docs.python.org — genericpath.sameopenfile
Tags: #public #python3 #stdlib #genericpath
Import
import genericpath
from genericpath import sameopenfile
Signature & Overview
genericpath.sameopenfile(fp1, fp2)
Test whether two open file objects reference the same file
Usage
import os
import tempfile
with tempfile.TemporaryFile() as f:
assert os.path.sameopenfile(f.fileno(), f.fileno()) is True
Gotchas
- Takes integer file descriptors (
fd1, fd2), not path strings.
REPL Inspect
from genericpath import sameopenfile
help(sameopenfile)
Linked from
Related notes
- tuts/python3/stdlib_module/genericpath/samefile Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/samestat Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/genericpath/commonprefix Linked here; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/exists Linked here; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getatime Linked here; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getctime Linked here; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getmtime shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getsize shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/isdevdrive shared tags: #genericpath, #stdlib