Python Forum
Int.From_Bytes Method - Conversion of Non-Escaped Bytes Objects
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Int.From_Bytes Method - Conversion of Non-Escaped Bytes Objects
#2
(Jan-17-2024, 08:54 PM)new_coder_231013 Wrote: Does it have something to do with the base system of the input and / or output - such as the particular base system the method assumes the input is expressed in? Or the base system it uses for the output? What am I missing here?
The key thing to understand about the bytes type in Python is that while Python prints b'Hello world', the bytes object is actually an array of small integers
>>> list(b'Hello world')
[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
>>> a = b'Hello world'
>>> a[0]
72
>>> a[1]
101
The printed version uses Ascii encoding for printable characters.
« We can solve any problem by introducing an extra level of indirection »
Reply


Messages In This Thread
RE: Int.From_Bytes Method - Conversion of Non-Escaped Bytes Objects - by Gribouillis - Jan-17-2024, 09:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Does XLRD have a method to extract embedded objects (pdf) from an excel sheet? matthewme 1 2,567 Jun-13-2019, 10:00 PM
Last Post: Larz60+
  replace bytes with other byte or bytes BigOldArt 1 10,787 Feb-02-2019, 11:00 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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