Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert result to hex ascii
#5
Ok, I went the wrong direction.

13889 -> bytes = (0x36, 0x41) or (54, 65) -> ascii characters = ("6", "a") -> string = "6a"

number = 13889
as_bytes = number.to_bytes(2, "big")
as_ascii = "".join(chr(b) for b in as_bytes)
print(as_ascii)
Output:
6a
Reply


Messages In This Thread
convert result to hex ascii - by Jusufs - May-19-2023, 10:43 AM
RE: convert result to hex ascii - by deanhystad - May-19-2023, 11:03 AM
RE: convert result to hex ascii - by Jusufs - May-19-2023, 11:20 AM
RE: convert result to hex ascii - by buran - May-19-2023, 11:28 AM
RE: convert result to hex ascii - by Jusufs - May-19-2023, 11:31 AM
RE: convert result to hex ascii - by deanhystad - May-19-2023, 11:30 AM
RE: convert result to hex ascii - by deanhystad - May-19-2023, 03:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert SQLite Fetchone() Result to float for Math Extra 13 3,747 Aug-02-2022, 01:12 PM
Last Post: deanhystad
  convert hex encoded string to ASCII Skaperen 4 114,728 Oct-02-2016, 09:22 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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