Overview:
- The method partition() of bytearray class splits the bytearray into two based on the given separator.
- The separator can consist of a single byte or more than one byte.
- The partition() method returns the first part, separator and the second part as a tuple. Each part in the tuple including the separator is returned as a bytearray.

Example:
|
# Example Python program that creates # Create a bytearray # Specify the byte(s) on which to partition the bytearray # Partition the byte array |
Output:
| bytearray(b'Of shoes') bytearray(b'--') bytearray(b'and ships--and sealing-wax--') |