❌ ✅ ✅ ✅ ✅ ✅ ✅

uio(输入/输出) – Input/output streams

此模块包含行为类似文件的流对象。

class BytesIO(​)
class BytesIO(data)
class BytesIO(alloc_size)

使用内存字节缓冲区的二进制流。

参数:
  • data (bytes or bytearray) – 可选的、包含初始数据的类字节对象。

  • alloc_size (int) – 可选的预分配字节数。此参数是 MicroPython 特有的,不建议在终端用户代码中使用。

getvalue() → bytes

获取底层缓冲区的内容。

class StringIO(​)
class StringIO(string)
class StringIO(alloc_size)

使用内存字符串缓冲区的流。

参数:
  • string (str) – 可选的、包含初始数据的字符串。

  • alloc_size (int) – 可选的预分配字节数。此参数是 MicroPython 特有的,不建议在终端用户代码中使用。

getvalue() → str

获取底层缓冲区的内容。

class FileIO

此类型表示使用 open(name, 'rb') 以二进制模式打开的文件。你不应该直接实例化此类。