Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parsing question
#4
That's not one character "\xffp", that's two bytes. The first is '\xff' (which I print as "ff") and the second is "p" (which I print as 70).

>>> b'\xff' + b'\x70'
b'\xffp'
>>> len(b'\xffp')
2
If the bytes in the bytestring have some meaning (like every pair represents something), then that would change how you parse it. All I've done is take all the bytes and display them with their hex code. The default python print statement does similar, but if the byte is in the ASCII range, it replaces it with the ASCII character.
Reply


Messages In This Thread
parsing question - by ridgerunnersjw - Oct-09-2020, 07:50 PM
RE: parsing question - by bowlofred - Oct-09-2020, 08:20 PM
RE: parsing question - by ridgerunnersjw - Oct-09-2020, 08:38 PM
RE: parsing question - by bowlofred - Oct-09-2020, 09:13 PM
RE: parsing question - by Skaperen - Oct-10-2020, 02:48 AM
RE: parsing question - by ridgerunnersjw - Oct-10-2020, 06:55 PM
RE: parsing question - by bowlofred - Oct-10-2020, 08:10 PM
RE: parsing question - by ridgerunnersjw - Oct-10-2020, 09:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  parsing question ridgerunnersjw 3 2,099 Oct-06-2020, 02:06 AM
Last Post: micseydel
  string parsing question ( I think) diggee17 4 3,121 Jul-24-2019, 02:37 PM
Last Post: diggee17
  Parsing Large Numbers Question amyvaulhausen 5 3,464 Mar-24-2019, 08:46 AM
Last Post: samsonite

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020