mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
docs: Add _io module reference.
This commit is contained in:
46
docs/library/_io.rst
Normal file
46
docs/library/_io.rst
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
:mod:`_io` -- input/output streams
|
||||||
|
==================================
|
||||||
|
|
||||||
|
.. module:: _io
|
||||||
|
:synopsis: input/output streams
|
||||||
|
|
||||||
|
This module contains additional types of stream (file-like) objects
|
||||||
|
and helper functions.
|
||||||
|
|
||||||
|
Functions
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. function:: open(name, mode='r', **kwargs)
|
||||||
|
|
||||||
|
Open a file. Builtin ``open()`` function is alised to this function.
|
||||||
|
All ports (which provide access to file system) are required to support
|
||||||
|
`mode` parameter, but support for other arguments vary by port.
|
||||||
|
|
||||||
|
Classes
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. class:: FileIO(...)
|
||||||
|
|
||||||
|
This is type of a file open in binary mode, e.g. using ``open(name, "rb")``.
|
||||||
|
You should not instantiate this class directly.
|
||||||
|
|
||||||
|
.. class:: TextIOWrapper(...)
|
||||||
|
|
||||||
|
This is type of a file open in text mode, e.g. using ``open(name, "rt")``.
|
||||||
|
You should not instantiate this class directly.
|
||||||
|
|
||||||
|
.. class:: StringIO([string])
|
||||||
|
.. class:: BytesIO([string])
|
||||||
|
|
||||||
|
In-memory file-like objects for input/output. `StringIO` is used for
|
||||||
|
text-mode I/O (similar to a normal file opened with "t" modifier).
|
||||||
|
`BytesIO` is used for binary-mode I/O (similar to a normal file
|
||||||
|
opened with "b" modifier). Initial contents of file-like objects
|
||||||
|
can be specified with `string` parameter (should be normal string
|
||||||
|
for `StringIO` or bytes object for `BytesIO`). All the usual file
|
||||||
|
methods like ``read()``, ``write()``, ``close()`` are available on
|
||||||
|
these objects, and additionally, following method:
|
||||||
|
|
||||||
|
.. method:: getvalue()
|
||||||
|
|
||||||
|
Get the current contents of the underlying buffer which holds data.
|
||||||
@@ -30,6 +30,7 @@ library.
|
|||||||
cmath.rst
|
cmath.rst
|
||||||
_collections.rst
|
_collections.rst
|
||||||
gc.rst
|
gc.rst
|
||||||
|
_io.rst
|
||||||
math.rst
|
math.rst
|
||||||
select.rst
|
select.rst
|
||||||
sys.rst
|
sys.rst
|
||||||
@@ -52,6 +53,7 @@ library.
|
|||||||
cmath.rst
|
cmath.rst
|
||||||
_collections.rst
|
_collections.rst
|
||||||
gc.rst
|
gc.rst
|
||||||
|
_io.rst
|
||||||
math.rst
|
math.rst
|
||||||
select.rst
|
select.rst
|
||||||
sys.rst
|
sys.rst
|
||||||
@@ -89,6 +91,7 @@ library.
|
|||||||
|
|
||||||
_collections.rst
|
_collections.rst
|
||||||
gc.rst
|
gc.rst
|
||||||
|
_io.rst
|
||||||
math.rst
|
math.rst
|
||||||
sys.rst
|
sys.rst
|
||||||
ubinascii.rst
|
ubinascii.rst
|
||||||
|
|||||||
Reference in New Issue
Block a user