Skip to content

Instantly share code, notes, and snippets.

@jszakmeister
Created December 13, 2016 09:35
Show Gist options
  • Save jszakmeister/e18607a026749956f0bd7a30cd148fa6 to your computer and use it in GitHub Desktop.
Save jszakmeister/e18607a026749956f0bd7a30cd148fa6 to your computer and use it in GitHub Desktop.
Example showing file handle being re-used...
import os
f = os.open('file1.txt', os.O_RDWR | os.O_CREAT)
print("Handle1: {!r}".format(f))
os.close(f)
f = open('file2.txt', 'w+b')
print("Handle2: {!r}".format(f.fileno()))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment