bytes_subscr.py 205 B

123456789101112131415
  1. # test [...] of bytes
  2. print(b'123'[0])
  3. print(b'123'[1])
  4. print(b'123'[-1])
  5. try:
  6. b'123'[1] = 4
  7. except TypeError:
  8. print('TypeError')
  9. try:
  10. del b'123'[1]
  11. except TypeError:
  12. print('TypeError')