There is a byte stream from socket and it comes likes this
b”8=FIXT.1.1×019=000076×0135=Ax0149=ABCDx0156=0109×01″
I need to strip the last x01 (or \x01)
So here is the sample python script to demo my requirement
#!/usr/bin/python
test=b"8=FIXT.1.1\x019=000076\x0135=A\x0149=ABCD\x0156=0109\x01"
print(test)
data=str(test)
data=data.rstrip("\x01")
print(data)
It needs to print. like this after striping the last bytes
b'8=FIXT.1.1\x019=000076\x0135=A\x0149=ABCD\x0156=0109\x01'
b'8=FIXT.1.1\x019=000076\x0135=A\x0149=ABCD\x0156=0109
but it prints like this without stripping
b'8=FIXT.1.1\x019=000076\x0135=A\x0149=ABCD\x0156=0109\x01'
b'8=FIXT.1.1\x019=000076\x0135=A\x0149=ABCD\x0156=0109\x01'
How to do that in python3 ?