Overview:
- On a given bytearray object, the method endswith() checks for a specific suffix.
- If the bytearray ends with the specified subsequence, then the method returns True. The method returns False otherwise.
- The endswith() method can be specified of a start index and end index between which it can look for the suffix.
Example:
|
# Example Python program that finds whether a # Main sequence # Find whether the main sequence ends with the |
Output:
|
The main sequence ends with b'by': True |
Example:
|
# Example Python program that finds whether a byteSeq = b"So long lives this, and this gives life to thee." startPos = 0 # Find the suffix is present in the sequence as specified |
Output:
|
The suffix b'this' is present: True |