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.
12 lines
287 B
12 lines
287 B
# test construction of bytearray from different objects
|
|
|
|
print(bytearray(b'123'))
|
|
print(bytearray('1234', 'utf-8'))
|
|
print(bytearray('12345', 'utf-8', 'strict'))
|
|
print(bytearray((1, 2)))
|
|
print(bytearray([1, 2]))
|
|
|
|
try:
|
|
print(bytearray('1234'))
|
|
except TypeError:
|
|
print("TypeError")
|
|
|