You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
25 lines
347 B
Python
25 lines
347 B
Python
# Extended stream operations on io.BytesIO
|
|
try:
|
|
import uio as io
|
|
except ImportError:
|
|
import io
|
|
|
|
a = io.BytesIO()
|
|
print(a.seek(8))
|
|
a.write(b"123")
|
|
print(a.getvalue())
|
|
|
|
print(a.seek(0, 1))
|
|
|
|
print(a.seek(-1, 2))
|
|
a.write(b"0")
|
|
print(a.getvalue())
|
|
|
|
a.flush()
|
|
print(a.getvalue())
|
|
|
|
a.seek(0)
|
|
arr = bytearray(10)
|
|
print(a.readinto(arr))
|
|
print(arr)
|