by = b'x01x02' print(by) by = by.rstrip() print(by) by = by.rstrip(chr(2).encode()) print(by)
b'x01x02'b'x01x02'b'x01'