You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
329 B
21 lines
329 B
4 years ago
|
# 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())
|