blob: 2edb7136a969147353442d6d094499e9b6307a56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# Make sure that write operations on io.BytesIO don't
# change original object it was constructed from.
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())
|