Skip to content

Instantly share code, notes, and snippets.

@Kroisse
Last active May 23, 2019 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kroisse/e28b435e085ab5348ab81ee2dddd99a2 to your computer and use it in GitHub Desktop.
Save Kroisse/e28b435e085ab5348ab81ee2dddd99a2 to your computer and use it in GitHub Desktop.
io
>>> f = open('setup.py')
>>> f
<_io.TextIOWrapper name='setup.py' mode='r' encoding='UTF-8'>
>>> import io
>>> isinstance(f, io.TextIOBase)
True
>>> isinstance(f, io.BufferedIOBase)
False
>>> isinstance(f, io.RawIOBase)
False
>>> f = open('setup.py', 'rb')
>>> f
<_io.BufferedReader name='setup.py'>
>>> isinstance(f, io.TextIOBase)
False
>>> isinstance(f, io.BufferedIOBase)
True
>>> isinstance(f, io.RawIOBase)
False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment