566d8f1d7e
Previously, "import _io" worked on both CPython and MicroPython (essentially by a chance on CPython, as there's not guarantee that its contents will stay the same across versions), but as the module was renamed to uio, need to use more robust import sequence for compatibility.
10 lines
155 B
Python
10 lines
155 B
Python
try:
|
|
import uio as io
|
|
except ImportError:
|
|
import io
|
|
|
|
# test __enter__/__exit__
|
|
with io.StringIO() as b:
|
|
b.write("foo")
|
|
print(b.getvalue())
|