You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
21 lines
329 B
Python
21 lines
329 B
Python
# Make sure that write operations on io.BytesIO don't
|
|
# change original object it was constructed from.
|
|
try:
|
|
import uio as io
|
|
except ImportError:
|
|
import io
|
|
|
|
b = b"foobar"
|
|
|
|
a = io.BytesIO(b)
|
|
a.write(b"1")
|
|
print(b)
|
|
print(a.getvalue())
|
|
|
|
b = bytearray(b"foobar")
|
|
|
|
a = io.BytesIO(b)
|
|
a.write(b"1")
|
|
print(b)
|
|
print(a.getvalue())
|