Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parsing question
#2
This is just the default way that python prints bytes that don't have ascii mappings. If you didn't care about printable vs non-printable, and just want all the numbers, I'd do something like this:

b = b'\x00\xd0\xffp\x01p\x01 \x00 \xff\xa0\x00 \x01\x90\x00\xf0\x00\xf0\x00 \x01P'

for byte in b:
    print(format(byte, "x"))
Output:
0 d0 ff 70 1 70 1 20 0 20 ff a0 0 20 1 90 0 f0 0 f0 0 20 1 50
Do you need the bytes that are ascii to remain in ascii format?
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,096 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,463 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