Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bytearray questions
#2
import binascii
binascii.b2a_hex(bytearray(b'K\x01\x01\x00\x00\x08\x04\x97*f9'))
Output:
b'4b010100000804972a6639'
The returned Value is represented by raw bytes.
To get the hexadecimal representation of bytes, use binascii.b2a_hex.
a == ASCII
b == Binary

Finally you have to slice the result, to get the ID.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Bytearray questions - by mattps - Mar-24-2018, 06:02 PM
RE: Bytearray questions - by DeaD_EyE - Mar-24-2018, 06:43 PM
RE: Bytearray questions - by mattps - Mar-25-2018, 06:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Value error when converting hex value to bytearray shubhamjainj 7 10,631 Mar-20-2023, 05:30 PM
Last Post: Skaperen
  appending to a bytearray Skaperen 21 14,788 Mar-19-2023, 11:05 PM
Last Post: Skaperen
  Split Bytearray into separate Files by Hex delimter lastyle 5 2,746 Mar-09-2023, 07:49 AM
Last Post: bowlofred
  Save multiple Parts of Bytearray to File ? lastyle 1 973 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  bytearray object - why converting to ascii? Chepilo 2 1,686 Nov-21-2022, 07:25 PM
Last Post: Chepilo
  Bytearray substitution Vismuto 1 2,641 Apr-14-2020, 09:18 AM
Last Post: TomToad
  int() function with bytearray() Jona66 1 2,419 Sep-08-2019, 12:41 PM
Last Post: ichabod801
  Conversion needed from bytearray to Floating point braveYug 1 4,149 May-07-2018, 12:23 PM
Last Post: snippsat
  Windows DIB format in bytearray to image? dusca 2 2,796 Mar-28-2018, 10:35 PM
Last Post: dusca
  ByteArray outside while true Schampbakken 5 4,408 Feb-18-2018, 02:02 PM
Last Post: buran

Forum Jump:

User Panel Messages

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